From d5dd7716747effab3ebbe891ec21ba753499aa33 Mon Sep 17 00:00:00 2001 From: vda Date: Sat, 23 Dec 2006 00:49:10 +0000 Subject: find: fix spurious -exec error messages (bug reported by Bernhard Fischer ) git-svn-id: svn://busybox.net/trunk/busybox@17060 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- libbb/xfuncs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libbb') diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 9efccc542..136dd1cca 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c @@ -181,6 +181,7 @@ void xfflush_stdout(void) // -1 for failure. Runs argv[0], searching path if that has no / in it. pid_t spawn(char **argv) { + /* Why static? */ static int failed; pid_t pid; void *app = ENABLE_FEATURE_SH_STANDALONE_SHELL ? find_applet_by_name(argv[0]) : 0; @@ -196,10 +197,14 @@ pid_t spawn(char **argv) // and then exit to unblock parent (but don't run atexit() stuff, which // would screw up parent.) - failed = -1; + failed = errno; _exit(0); } - return failed ? failed : pid; + if (failed) { + errno = failed; + return -1; + } + return pid; } // Die with an error message if we can't spawn a child process. -- cgit v1.2.3-55-g6feb