public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: default to O_BINARY in fhandler_base::reset_to_open_binmode()
Date: Fri, 19 Feb 2021 17:15:28 +0000 (GMT)	[thread overview]
Message-ID: <20210219171528.773AD3857C48@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=543e39bb129ac77e29e3800a468100a754ad3d2a

commit 543e39bb129ac77e29e3800a468100a754ad3d2a
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri Feb 19 18:12:37 2021 +0100

    Cygwin: default to O_BINARY in fhandler_base::reset_to_open_binmode()
    
    This only affects the very seldom bordercase of apps calling setmode(fd,
    0) on fhandlers not calling fhandler_base::set_open_status().  All
    fhandlers not calling set_open_status() are binary mode only, but the
    way reset_to_open_binmode worked, calling setmode(fd, 0) would have
    "reset" their open flags to O_TEXT accidentally.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/fhandler.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 5d095d384..12c45a5d7 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -274,7 +274,8 @@ class fhandler_base
   void reset_to_open_binmode ()
   {
     set_flags ((get_flags () & ~(O_TEXT | O_BINARY))
-	       | ((open_status.wbinary || open_status.rbinary)
+	       | (((open_status.wbinset ? open_status.wbinary : 1)
+		   || (open_status.rbinset ? open_status.rbinary : 1))
 		   ? O_BINARY : O_TEXT));
   }


                 reply	other threads:[~2021-02-19 17:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210219171528.773AD3857C48@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).