diff options
author | James Youngman <jay@gnu.org> | 2005-01-08 12:31:06 +0000 |
---|---|---|
committer | James Youngman <jay@gnu.org> | 2005-01-08 12:31:06 +0000 |
commit | 03461a7dda9b02f2dab9def88a0cecac6cd96dc4 (patch) | |
tree | d5174f8935859cb717e0ca890019b9da6605b185 | |
parent | 0f87f51ff0af413207057c9494a34a882657c03f (diff) | |
download | findutils-03461a7dda9b02f2dab9def88a0cecac6cd96dc4.tar.gz |
Savannah bug 11517: find, xargs, locate, etc. should not hide write failures; patch from Jim Meyering
-rw-r--r-- | find/find.c | 4 | ||||
-rw-r--r-- | find/pred.c | 6 | ||||
-rwxr-xr-x | import-gnulib.sh | 4 | ||||
-rw-r--r-- | locate/bigram.c | 2 | ||||
-rw-r--r-- | locate/code.c | 2 | ||||
-rw-r--r-- | locate/frcode.c | 2 | ||||
-rw-r--r-- | locate/locate.c | 2 | ||||
-rw-r--r-- | xargs/xargs.c | 3 |
8 files changed, 21 insertions, 4 deletions
diff --git a/find/find.c b/find/find.c index 9dfcebc5..6ca30a47 100644 --- a/find/find.c +++ b/find/find.c @@ -39,6 +39,7 @@ #include "../gnulib/lib/xalloc.h" #include "../gnulib/lib/human.h" #include "../gnulib/lib/canonicalize.h" +#include "closeout.h" #include <modetype.h> #include "../gnulib/lib/savedir.h" @@ -279,7 +280,8 @@ main (int argc, char **argv) #endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - + atexit(close_stdout); + if (isatty(0)) { options.warnings = true; diff --git a/find/pred.c b/find/pred.c index 254f16a5..bf124f6b 100644 --- a/find/pred.c +++ b/find/pred.c @@ -1187,7 +1187,11 @@ pred_quit (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) (void) pathname; (void) stat_buf; (void) pred_ptr; - exit(0); + + /* Since -exec and friends don't leave child processes running in the + * background, there is no need to wait for them here. + */ + exit(state.exit_status); /* 0 for success, etc. */ } boolean diff --git a/import-gnulib.sh b/import-gnulib.sh index 995b478c..fb51a441 100755 --- a/import-gnulib.sh +++ b/import-gnulib.sh @@ -40,7 +40,7 @@ getline getopt human idcache lstat malloc memcmp memset mktime \ modechange pathmax quotearg realloc regex rpmatch savedir stat \ stpcpy strdup strftime strstr strtol strtoul strtoull strtoumax \ xalloc xalloc-die xgetcwd xstrtol xstrtoumax yesno human filemode \ -getline stpcpy canonicalize mountlist" +getline stpcpy canonicalize mountlist closeout" # Modules needed for the "intl" subdirectory. #intl_modules="regex" @@ -132,4 +132,4 @@ printf "%s" "EXTRA_DIST = " cd gnulib/m4 ls *.m4 | sed -e 's/$/ \\/' | sed -e '$ s/\\$//' echo -) > gnulib/m4/Makefile.am
\ No newline at end of file +) > gnulib/m4/Makefile.am diff --git a/locate/bigram.c b/locate/bigram.c index d0d0f364..cb28c0ad 100644 --- a/locate/bigram.c +++ b/locate/bigram.c @@ -47,6 +47,7 @@ #include <getline.h> #include <xalloc.h> +#include "closeout.h" /* The name this program was run with. */ char *program_name; @@ -73,6 +74,7 @@ main (int argc, char **argv) program_name = argv[0]; (void) argc; + atexit(close_stdout); pathsize = oldpathsize = 1026; /* Increased as necessary by getline. */ path = xmalloc (pathsize); diff --git a/locate/code.c b/locate/code.c index d78287fc..0eb1772e 100644 --- a/locate/code.c +++ b/locate/code.c @@ -76,6 +76,7 @@ #include "locatedb.h" #include <getline.h> +#include "closeout.h" char *xmalloc PARAMS((size_t)); @@ -145,6 +146,7 @@ main (int argc, char **argv) int line_len; /* Length of input line. */ program_name = argv[0]; + atexit(close_stdout); bigram[2] = '\0'; diff --git a/locate/frcode.c b/locate/frcode.c index 4f20b589..35561fca 100644 --- a/locate/frcode.c +++ b/locate/frcode.c @@ -102,6 +102,7 @@ #include "locatedb.h" #include <getline.h> #include <getopt.h> +#include "closeout.h" char *xmalloc PARAMS((size_t)); @@ -165,6 +166,7 @@ main (int argc, char **argv) int optc; program_name = argv[0]; + atexit(close_stdout); pathsize = oldpathsize = 1026; /* Increased as necessary by getline. */ path = xmalloc (pathsize); diff --git a/locate/locate.c b/locate/locate.c index 7bd59fce..f951d2df 100644 --- a/locate/locate.c +++ b/locate/locate.c @@ -110,6 +110,7 @@ extern int errno; #include "../gnulib/lib/error.h" #include "../gnulib/lib/human.h" #include "dirname.h" +#include "closeout.h" /* Note that this evaluates C many times. */ #ifdef _LIBC @@ -765,6 +766,7 @@ main (argc, argv) #endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + atexit(close_stdout); dbpath = getenv ("LOCATE_PATH"); if (dbpath == NULL) diff --git a/xargs/xargs.c b/xargs/xargs.c index 150a40ee..8aaea23f 100644 --- a/xargs/xargs.c +++ b/xargs/xargs.c @@ -164,6 +164,8 @@ typedef int boolean; #endif #include <xalloc.h> +#include "closeout.h" + void error PARAMS ((int status, int errnum, char *message,...)); extern char *version_string; @@ -357,6 +359,7 @@ main (int argc, char **argv) #endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + atexit(close_stdout); /* IEE Std 1003.1, 2003 specifies that the combined argument and * environment list shall not exceed {ARG_MAX}-2048 bytes. It also |