[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: add some fd tests to head
From: |
Eric Blake |
Subject: |
Re: add some fd tests to head |
Date: |
Mon, 09 Oct 2006 21:54:42 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Eric Blake on 10/4/2006 5:30 PM:
> I still need to add more tests from the mailing lists, but here is a group of
> tests that expose current shortfalls in handling closed fds.
And I backported the detection of stderr write failures to the branch.
2006-10-09 Eric Blake <address@hidden>
* src/m4.c (usage, main): Detect write failures to stderr.
* src/builtin.c (m4_m4exit): Likewise.
* NEWS: Document this.
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFKxmC84KuGfSFAYARAu0lAJ9bzrwwEs8fVwown08l/K2AFGQ2KQCgsFS6
gaMyt7iNKH+p23kLpkemcHI=
=k1YF
-----END PGP SIGNATURE-----
Index: NEWS
===================================================================
RCS file: /sources/m4/m4/NEWS,v
retrieving revision 1.1.1.1.2.67
diff -u -p -r1.1.1.1.2.67 NEWS
--- NEWS 10 Oct 2006 03:27:15 -0000 1.1.1.1.2.67
+++ NEWS 10 Oct 2006 03:52:52 -0000
@@ -11,6 +11,8 @@ Version 1.4.8 - ?? ??? 2006, by ?? (CVS
to remove the default limit of 1024. However, it is still possible that
heavily nested input can cause abrupt program termination due to stack
overflow.
+* Problems encountered when writing to standard error, such as with the
+ `errprint' macro, now always cause a non-zero exit status.
Version 1.4.7 - 25 September 2006, by Eric Blake (CVS version 1.4.6a)
Index: src/builtin.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/builtin.c,v
retrieving revision 1.1.1.1.2.40
diff -u -p -r1.1.1.1.2.40 builtin.c
--- src/builtin.c 11 Sep 2006 13:17:21 -0000 1.1.1.1.2.40
+++ src/builtin.c 10 Oct 2006 03:52:52 -0000
@@ -1301,6 +1301,8 @@ m4_m4exit (struct obstack *obs, int argc
if (exit_code == 0)
exit_code = EXIT_FAILURE;
}
+ if (close_stream (stderr) != 0 && exit_code == 0)
+ exit_code = EXIT_FAILURE;
if (exit_code == 0 && retcode != 0)
exit_code = retcode;
exit (exit_code);
Index: src/m4.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/m4.c,v
retrieving revision 1.1.1.1.2.32
diff -u -p -r1.1.1.1.2.32 m4.c
--- src/m4.c 10 Oct 2006 02:56:18 -0000 1.1.1.1.2.32
+++ src/m4.c 10 Oct 2006 03:52:52 -0000
@@ -207,6 +207,8 @@ mismatch, or whatever value was passed t
if (close_stream (stdout) != 0)
M4ERROR ((EXIT_FAILURE, errno, "write error"));
+ if (close_stream (stderr) != 0)
+ exit (EXIT_FAILURE); /* Can't really do much else without stderr. */
exit (status);
}
@@ -429,7 +431,9 @@ Written by Rene' Seindal.\n\
", stdout);
if (close_stream (stdout) != 0)
- M4ERROR ((EXIT_FAILURE, errno, "write error"));
+ M4ERROR ((EXIT_FAILURE, errno, "write error"));
+ if (close_stream (stderr) != 0)
+ exit (EXIT_FAILURE);
exit (EXIT_SUCCESS);
break;
@@ -569,5 +573,7 @@ Written by Rene' Seindal.\n\
if (close_stream (stdout) != 0)
M4ERROR ((EXIT_FAILURE, errno, "write error"));
+ if (close_stream (stderr) != 0)
+ exit (EXIT_FAILURE); /* Can't really do much else without stderr. */
exit (retcode);
}