summaryrefslogtreecommitdiffhomepage
path: root/libbb/xfuncs.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-12-23 00:49:10 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-12-23 00:49:10 +0000
commit8f6c79240dc7c1e0b819a1a1309240477d8e0d84 (patch)
tree79b9cc0ea2e0077dc8e78c1adc6a61c6992becba /libbb/xfuncs.c
parent4cccc03768ecde58e8acd5e4f40e51227e3c14cc (diff)
find: fix spurious -exec error messages
(bug reported by Bernhard Fischer <rep.nop@aon.at>)
Diffstat (limited to 'libbb/xfuncs.c')
-rw-r--r--libbb/xfuncs.c9
1 files changed, 7 insertions, 2 deletions
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.