aboutsummaryrefslogtreecommitdiff
path: root/lib/portability.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-12-04 21:46:59 -0600
committerRob Landley <rob@landley.net>2014-12-04 21:46:59 -0600
commit50fc9ed007b084883fb09c64866c45c571e70a99 (patch)
treee74fcf5c070a01666382e077394f62687af69dd1 /lib/portability.c
parent2fb85a3588bf2271e0506c5ab3bcb6a84bf77255 (diff)
downloadtoybox-50fc9ed007b084883fb09c64866c45c571e70a99.tar.gz
Work with buildroot's extensively patched uClibc, and for nommu support move xfork() to portability.h and #ifdef based on __uClinux__ (which seems to be the nommu compiler define).
Diffstat (limited to 'lib/portability.c')
-rw-r--r--lib/portability.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/portability.c b/lib/portability.c
index 910b1ea9..7d6d85f3 100644
--- a/lib/portability.c
+++ b/lib/portability.c
@@ -6,6 +6,17 @@
#include "toys.h"
+#if !defined(__uClinux__)
+pid_t xfork(void)
+{
+ pid_t pid = fork();
+
+ if (pid < 0) perror_exit("fork");
+
+ return pid;
+}
+#endif
+
#if defined(__APPLE__)
ssize_t getdelim(char **linep, size_t *np, int delim, FILE *stream)
{