bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] closein: correct comments


From: Eric Blake
Subject: [PATCH] closein: correct comments
Date: Wed, 10 Aug 2011 05:31:16 -0600

* lib/closein.c (close_stdin): Improve comments.

Signed-off-by: Eric Blake <address@hidden>
---

I noticed this while auditing to see which modules might have been
affected by the recently-fixed fseeko bug.

 ChangeLog     |    5 +++++
 lib/closein.c |    5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 701f07b..538c121 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-10  Eric Blake  <address@hidden>
+
+       closein: correct comments
+       * lib/closein.c (close_stdin): Improve comments.
+
 2011-08-09  Bruno Haible  <address@hidden>

        More tests for 'fseeko'.
diff --git a/lib/closein.c b/lib/closein.c
index beff8bb..2a652f4 100644
--- a/lib/closein.c
+++ b/lib/closein.c
@@ -55,7 +55,7 @@ close_stdin_set_file_name (const char *file)
    For example, POSIX requires that these two commands behave alike:

      (sed -ne 1q; cat) < file
-     tail -n 1 file
+     tail -n +2 file

    Since close_stdin is commonly registered via 'atexit', POSIX
    and the C standard both say that it should not call 'exit',
@@ -82,7 +82,8 @@ close_stdin (void)

   /* There is no need to flush stdin if we can determine quickly that stdin's
      input buffer is empty; in this case we know that if stdin is seekable,
-     fseeko (stdin, 0, SEEK_CUR) == lseek (0, 0, SEEK_CUR).  */
+     (fseeko (stdin, 0, SEEK_CUR), ftello (stdin))
+     == lseek (0, 0, SEEK_CUR).  */
   if (freadahead (stdin) > 0)
     {
       /* Only attempt flush if stdin is seekable, as fflush is entitled to
-- 
1.7.4.4




reply via email to

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