bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] input: fix logic bug that breaks on O_TEXT systems


From: Eric Blake
Subject: [PATCH] input: fix logic bug that breaks on O_TEXT systems
Date: Thu, 24 Sep 2015 15:47:29 -0600

The bash-20101229 snapshot introduced an attempt to incorporate
some patches that were previously used downstream by Cygwin
with regards to managing scripts read with O_TEXT mode (where
lseek() sees different offsets than the number of bytes read,
because the system is converting physical '\r\n' into logical
'\n').  But it introduced a typo, using O_TEXT where it meant
to use B_TEXT, with the result that scripts read in text mode
would seek to the wrong location.

Thanks to Jeff Downs for helping me find the typo.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/input.c b/input.c
index 2a9ca26..308b87e 100644
--- a/input.c
+++ b/input.c
@@ -205,7 +205,7 @@ make_buffered_stream (fd, buffer, bufsize)
   if (bufsize == 1)
     bp->b_flag |= B_UNBUFF;
   if (O_TEXT && (fcntl (fd, F_GETFL) & O_TEXT) != 0)
-    bp->b_flag |= O_TEXT;
+    bp->b_flag |= B_TEXT;
   return (bp);
 }

-- 
2.4.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]