aboutsummaryrefslogtreecommitdiff
path: root/lib/xwrap.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-05-31 12:33:24 -0500
committerRob Landley <rob@landley.net>2014-05-31 12:33:24 -0500
commitd8872c43b48eae5501998a4e5a84337017d8fbe6 (patch)
tree8360d8673d0ed40b02f9d58bdf74b639f6e780f9 /lib/xwrap.c
parentb0d97a0059555cb0e7e0009b72c038aa67aaa769 (diff)
downloadtoybox-d8872c43b48eae5501998a4e5a84337017d8fbe6.tar.gz
Introduce xfork() and make commands use it, and make some WEXITSTATUS() use WIFEXITED() and WTERMSIG()+127.
Diffstat (limited to 'lib/xwrap.c')
-rw-r--r--lib/xwrap.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c
index 69682f65..3e146fb7 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -113,6 +113,15 @@ void xflush(void)
if (fflush(stdout) || ferror(stdout)) perror_exit("write");;
}
+pid_t xfork(void)
+{
+ pid_t pid = fork();
+
+ if (pid < 0) perror_exit("fork");
+
+ return pid;
+}
+
// Call xexec with a chunk of optargs, starting at skip. (You can't just
// call xexec() directly because toy_init() frees optargs.)
void xexec_optargs(int skip)