[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: |
Fri, 06 Oct 2006 07:13:00 -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/5/2006 5:06 PM:
>
> Indeed, here are some more tests, and some (but not all) fixes. In
> particular,
> this will not completely work until gnulib's closeout module checks for write
> errors on stderr, as was proposed a few days ago but not committed yet.
And another followup; this cleans up an assertion caught by the testsuite.
2006-10-06 Eric Blake <address@hidden>
* modules/m4.c (m4exit): Merge from branch.
* m4/m4.c (m4_delete): Avoid assertion triggered by last patch.
- --
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
iD4DBQFFJlZc84KuGfSFAYARAhKIAJoDcdw/Rz8dvisLWTOy49fSutzh0gCUC7yD
XmbQZ2Cyx6DVOwGejkhgNQ==
=AV4n
-----END PGP SIGNATURE-----
Index: modules/m4.c
===================================================================
RCS file: /sources/m4/m4/modules/m4.c,v
retrieving revision 1.78
diff -u -p -r1.78 m4.c
--- modules/m4.c 4 Oct 2006 03:57:01 -0000 1.78
+++ modules/m4.c 6 Oct 2006 13:11:25 -0000
@@ -39,6 +39,8 @@
# include "m4private.h"
#endif
+#include "exitfail.h"
+
/* Rename exported symbols for dlpreload()ing. */
#define m4_export_table m4_LTX_m4_export_table
#define m4_builtin_table m4_LTX_m4_builtin_table
@@ -703,14 +705,31 @@ M4BUILTIN_HANDLER (errprint)
arguments are present. */
M4BUILTIN_HANDLER (m4exit)
{
- int exit_code = 0;
+ int exit_code = EXIT_SUCCESS;
- if (argc == 2 && !m4_numeric_arg (context, argc, argv, 1, &exit_code))
- exit_code = 0;
+ /* Warn on bad arguments, but still exit. */
+ if (argc >= 2 && !m4_numeric_arg (context, argc, argv, 1, &exit_code))
+ exit_code = EXIT_FAILURE;
+ if (exit_code < 0 || exit_code > 255)
+ {
+ m4_warn (context, 0, _("%s: exit status out of range: `%d'"),
+ M4ARG (0), exit_code);
+ exit_code = EXIT_FAILURE;
+ }
/* Ensure any module exit callbacks are executed. */
m4__module_exit (context);
+ /* Change debug stream back to stderr, to force flushing debug
+ stream and detect any errors. */
+ m4_debug_set_output (context, NULL);
+
+ /* Check for saved error. */
+ if (exit_code == 0 && m4_get_exit_status (context) != 0)
+ exit_code == m4_get_exit_status (context);
+ /* Ensure that atexit handlers see correct nonzero status. */
+ if (exit_code != 0)
+ exit_failure = exit_code;
exit (exit_code);
}
Index: m4/m4.c
===================================================================
RCS file: /sources/m4/m4/m4/m4.c,v
retrieving revision 1.20
diff -u -p -r1.20 m4.c
--- m4/m4.c 5 Oct 2006 23:07:28 -0000 1.20
+++ m4/m4.c 6 Oct 2006 13:11:25 -0000
@@ -53,8 +53,9 @@ m4_delete (m4 *context)
if (context->syntax)
m4_syntax_delete (context->syntax);
- /* debug_file should have been reset to stderr, which is closed later. */
- assert (context->debug_file == stderr);
+ /* debug_file should have been reset to stdout or stderr, both of
+ which are closed later. */
+ assert (context->debug_file == stderr || context->debug_file == stdout);
obstack_free (&context->trace_messages, NULL);