diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-02-21 18:11:47 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-02-21 18:11:47 +0000 |
commit | e4a1f78e73c8edab487abbf5540990d62f95a666 (patch) | |
tree | 043e9d7662ad87bf090f5920bd85bf3cf1b5ae20 /libc/stdlib/unix_grantpt.c | |
parent | b0cc86a6fc6fc98d18e3bc232f1d83973d74cb3d (diff) |
When vfork is not available and we have an MMU, then use fork()
-Erik
Diffstat (limited to 'libc/stdlib/unix_grantpt.c')
-rw-r--r-- | libc/stdlib/unix_grantpt.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libc/stdlib/unix_grantpt.c b/libc/stdlib/unix_grantpt.c index 3dce71b6f..c29612e81 100644 --- a/libc/stdlib/unix_grantpt.c +++ b/libc/stdlib/unix_grantpt.c @@ -28,9 +28,15 @@ #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> - #include "pty-private.h" + +/* uClinux-2.0 has vfork, but Linux 2.0 doesn't */ +#include <sys/syscall.h> +#if ! defined __NR_vfork && defined __UCLIBC_HAS_MMU__ +#define vfork fork +#endif + extern int ptsname_r (int fd, char *buf, size_t buflen); /* Return the result of ptsname_r in the buffer pointed to by PTS, @@ -140,11 +146,7 @@ grantpt (int fd) /* We have to use the helper program. */ helper: -#ifdef __UCLIBC_HAS_MMU__ - pid = fork (); -#else pid = vfork (); -#endif if (pid == -1) goto cleanup; else if (pid == 0) @@ -156,10 +158,10 @@ grantpt (int fd) /* We pase the master pseudo terminal as file descriptor PTY_FILENO. */ if (fd != PTY_FILENO) if (dup2 (fd, PTY_FILENO) < 0) - exit (FAIL_EBADF); + _exit (FAIL_EBADF); execle (_PATH_PT_CHOWN, _PATH_PT_CHOWN, NULL, NULL); - exit (FAIL_EXEC); + _exit (FAIL_EXEC); } else { |