diff options
| author | Khem Raj <kraj@mvista.com> | 2009-04-14 19:20:51 +0000 |
|---|---|---|
| committer | Khem Raj <kraj@mvista.com> | 2009-04-14 19:20:51 +0000 |
| commit | a4674e039e70de4d1c6285fc79383aad014cf1c2 (patch) | |
| tree | 077ab511a2b707b0061e5a1a7fabbc1384c25ed5 /libc | |
| parent | 1507c79c68e0e6c390f9a82642cd548ed8556ce3 (diff) | |
| download | uClibc-alpine-a4674e039e70de4d1c6285fc79383aad014cf1c2.tar.bz2 uClibc-alpine-a4674e039e70de4d1c6285fc79383aad014cf1c2.tar.xz | |
Merged revisions 26046,26062,26066,26078 via svnmerge from
svn+ssh://kraj@svn.uclibc.org/svn/trunk/uClibc
........
r26046 | aldot | 2009-04-09 10:48:17 -0700 (Thu, 09 Apr 2009) | 2 lines
- fix typo
........
r26062 | austinf | 2009-04-10 17:08:47 -0700 (Fri, 10 Apr 2009) | 4 lines
sparc also needs CONSTANT_STRING_GOT_FIXUP for doing debug printing in ldso
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
........
r26066 | austinf | 2009-04-11 12:30:04 -0700 (Sat, 11 Apr 2009) | 5 lines
for sparc v8 MAGIC1 was defined incorrectly
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
........
r26078 | vapier | 2009-04-12 17:06:40 -0700 (Sun, 12 Apr 2009) | 1 line
make sure to block all signals when calling daemon() to prevent delivery while the parent is sharing the stack
........
Diffstat (limited to 'libc')
| -rw-r--r-- | libc/unistd/daemon.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c index 0e439d1ba..6543f1c11 100644 --- a/libc/unistd/daemon.c +++ b/libc/unistd/daemon.c @@ -44,6 +44,7 @@ #include <features.h> #include <fcntl.h> #include <paths.h> +#include <signal.h> #include <unistd.h> #ifdef __UCLIBC_HAS_THREADS_NATIVE__ #include <errno.h> @@ -66,7 +67,7 @@ /* use clone() to get fork() like behavior here -- we just want to disassociate * from the controlling terminal */ -static inline pid_t fork_parent(void) +static inline pid_t _fork_parent(void) { register unsigned long ret = INTERNAL_SYSCALL(clone, wtf, 2, CLONE_VM, 0); if (ret != -1 && ret != 0) @@ -74,6 +75,17 @@ static inline pid_t fork_parent(void) INTERNAL_SYSCALL(exit, wtf, 0); return ret; } +static inline pid_t fork_parent(void) +{ + /* Block all signals to keep the parent from using the stack */ + pid_t ret; + sigset_t new_set, old_set; + sigfillset(&new_set); + sigprocmask(SIG_BLOCK, &new_set, &old_set); + ret = _fork_parent(); + sigprocmask(SIG_SETMASK, &old_set, NULL); + return ret; +} #else static inline pid_t fork_parent(void) { |
