aboutsummaryrefslogtreecommitdiff
path: root/lib/xwrap.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-02-08 15:24:33 -0600
committerRob Landley <rob@landley.net>2016-02-08 15:24:33 -0600
commit85f54d8e836ac80264111df7d87db6c15eaca558 (patch)
tree65f3fe7b115aa758ebf528575c2a78f1df6e37b2 /lib/xwrap.c
parent9b14cb6aa57c56080bbbc0db85027c3f834fb06f (diff)
downloadtoybox-85f54d8e836ac80264111df7d87db6c15eaca558.tar.gz
Add xpipe() to lib.
Diffstat (limited to 'lib/xwrap.c')
-rw-r--r--lib/xwrap.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c
index 65e3018d..76b0ff37 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -33,6 +33,7 @@ void xexit(void)
if (toys.rebound) longjmp(*toys.rebound, 1);
if (fflush(NULL) || ferror(stdout))
if (!toys.exitval) perror_msg("write");
+
exit(toys.exitval);
}
@@ -309,6 +310,11 @@ int xopen(char *path, int flags)
return xcreate(path, flags, 0);
}
+void xpipe(int pp)
+{
+ if (pipe(pp)) perror_exit("xpipe");
+}
+
void xclose(int fd)
{
if (close(fd)) perror_exit("xclose");