aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-09-23 22:18:22 -0500
committerRob Landley <rob@landley.net>2015-09-23 22:18:22 -0500
commit847bcb63b541e4fbbfa3dccfe3022745cbe9a06a (patch)
tree35c6fb8b4bdb11e995a95919abfa682ab7c20221 /toys/posix
parent712e163bb0956b94c27051d0175e719b92f453ad (diff)
downloadtoybox-847bcb63b541e4fbbfa3dccfe3022745cbe9a06a.tar.gz
Add xvfork() as a static inline and use it from various places.
Note: vfork(), like fork(), can return -1 if too many processes, and we should notice and fail loudly.
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/time.c2
-rw-r--r--toys/posix/xargs.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/toys/posix/time.c b/toys/posix/time.c
index 70d2997e..b3cfd26b 100644
--- a/toys/posix/time.c
+++ b/toys/posix/time.c
@@ -28,7 +28,7 @@ void time_main(void)
struct timeval tv, tv2;
gettimeofday(&tv, NULL);
- if (!(pid = xfork())) xexec(toys.optargs);
+ if (!(pid = xvfork())) xexec(toys.optargs);
else {
int stat;
struct rusage ru;
diff --git a/toys/posix/xargs.c b/toys/posix/xargs.c
index 8178bf0c..50c42620 100644
--- a/toys/posix/xargs.c
+++ b/toys/posix/xargs.c
@@ -168,7 +168,7 @@ void xargs_main(void)
for (dtemp = dlist; dtemp; dtemp = dtemp->next)
handle_entries(dtemp->data, out+entries);
- pid_t pid=xfork();
+ pid_t pid=xvfork();
if (!pid) {
xclose(0);
open("/dev/null", O_RDONLY);