do not ignore errors like ENOSPC,EIO when writing to stdout

Standard output was never explicitly closed, so we could not
detect failure.  Thus, bison would ignore the errors of writing
to a full file system and getting an I/O error on write, but only
for standard output, e.g., for --print-localedir, --print-datadir,
--help and some verbose output.
Now, "bison --print-datadir > /dev/full" reports the write failure:
bison: write error: No space left on device
Before, it would exit 0 with no diagnostic, implying success.
This is not an issue for "--output=-" or the other FILE-accepting
command-line options, because unlike most other GNU programs,
an output file argument of "-" is treated as the literal "./-",
rather than standard output.
* bootstrap.conf (gnulib_modules): Add closeout.
* src/main.c: Include "closeout.h".
Use atexit to ensure we close stdout.
* .gitignore: Ignore new files pulled in via gnulib-tool.
(cherry picked from commit acb5895680)

Conflicts:

	m4/.gitignore
This commit is contained in:
Jim Meyering
2012-01-29 12:50:32 +01:00
committed by Akim Demaille
parent ec94982bec
commit e187b40d31
4 changed files with 22 additions and 13 deletions

View File

@@ -28,6 +28,7 @@
#include <timevar.h>
#include "LR0.h"
#include "closeout.h"
#include "complain.h"
#include "conflicts.h"
#include "derives.h"
@@ -62,6 +63,8 @@ main (int argc, char *argv[])
(void) bindtextdomain ("bison-runtime", LOCALEDIR);
(void) textdomain (PACKAGE);
atexit (close_stdout);
uniqstrs_new ();
muscle_init ();