[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stdin seekable failure
From: |
Eric Blake |
Subject: |
Re: stdin seekable failure |
Date: |
Thu, 12 Apr 2007 14:52:45 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Eric Blake on 4/12/2007 10:11 AM:
>> So I suggest creating a new module 'closein' instead.
>
> Done like so.
>
> 2007-04-12 Eric Blake <address@hidden>
>
> Work around glibc's failure to reset seekable stdin on exit.
> * modules/closein: New module.
And it still failed on Linux, since glibc won't even flush input streams
on fclose. But rather than write rpl_fclose, I think the simpler fix is
just explicitly flushing as part of close_stdin, seeing as how so few
programs actually need to flush stdin on exit. At which point, the m4
test that triggered this jaunt passes on Linux again (or skips, if you are
still using too-old sed).
2007-04-12 Eric Blake <address@hidden>
Work around glibc's failure to flush stdin on fclose.
* lib/closein.c (close_stdin): Flush stdin before closing.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGHpwd84KuGfSFAYARApBvAKCU/49S1e0gFN45wkxnTAb5yJsNPACfbkNw
67l+d2rQjnEqSzLIPRvx4t4=
=lxBR
-----END PGP SIGNATURE-----
Index: lib/closein.c
===================================================================
RCS file: /sources/gnulib/gnulib/lib/closein.c,v
retrieving revision 1.1
diff -u -p -r1.1 closein.c
--- lib/closein.c 12 Apr 2007 16:11:40 -0000 1.1
+++ lib/closein.c 12 Apr 2007 20:49:03 -0000
@@ -79,7 +79,7 @@ void
close_stdin (void)
{
bool fail = false;
- if (close_stream (stdin) != 0)
+ if (fflush (stdin) != 0 || close_stream (stdin) != 0)
{
char const *close_error = _("error closing file");
if (file_name)