aboutsummaryrefslogtreecommitdiff
path: root/src/librc/librc.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-02-02 14:22:37 +0000
committerRoy Marples <roy@marples.name>2008-02-02 14:22:37 +0000
commit7b27a12f6c4d6056f6f3da0a5a2aa7f5508a6f46 (patch)
treec5625006a398aa1095c7768d700cdd7a52005de8 /src/librc/librc.c
parent8830b5063618a11b19aadd7b61042dfb62066ee9 (diff)
OK, we have to use fork with sigprocmask as not all systems provide a working and sane kernel call to bypass libc.
Diffstat (limited to 'src/librc/librc.c')
-rw-r--r--src/librc/librc.c37
1 files changed, 10 insertions, 27 deletions
diff --git a/src/librc/librc.c b/src/librc/librc.c
index 3e6a1a9a..01863407 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -32,7 +32,6 @@
const char librc_copyright[] = "Copyright (c) 2007-2008 Roy Marples";
#include "librc.h"
-#include <sys/syscall.h>
#include <signal.h>
#define SOFTLEVEL RC_SVCDIR "/softlevel"
@@ -41,23 +40,6 @@ const char librc_copyright[] = "Copyright (c) 2007-2008 Roy Marples";
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
#endif
-/* Some platforms don't expose SYS_sigaction and friends.
- * So we hope that their libc does the Right Thing. */
-#ifdef SYS_sigaction
-# define do_sigaction(_sig, _new, _old) \
- syscall (SYS_sigaction, _sig, _new, _old);
-#else
-#define do_sigaction(_sig, _new, _old) \
- sigaction (_sig, _new, _old)
-#endif
-#ifdef SYS_sigprocmask
-# define do_sigprocmask(_sig, _new, _old) \
- syscall (SYS_sigprocmask, _sig, _new, _old);
-#else
-#define do_sigprocmask(_sig, _new, _old) \
- sigprocmask (_sig, _new, _old)
-#endif
-
/* File stream used for plugins to write environ vars to */
FILE *rc_environ_fd = NULL;
@@ -623,18 +605,19 @@ static pid_t _exec_service (const char *service, const char *arg)
sigemptyset (&empty);
sigfillset (&full);
sigprocmask (SIG_SETMASK, &full, &old);
- if ((pid = vfork ()) == 0) {
+
+ if ((pid = fork ()) == 0) {
/* Restore default handlers */
- do_sigaction (SIGCHLD, &sa, NULL);
- do_sigaction (SIGHUP, &sa, NULL);
- do_sigaction (SIGINT, &sa, NULL);
- do_sigaction (SIGQUIT, &sa, NULL);
- do_sigaction (SIGTERM, &sa, NULL);
- do_sigaction (SIGUSR1, &sa, NULL);
- do_sigaction (SIGWINCH, &sa, NULL);
+ sigaction (SIGCHLD, &sa, NULL);
+ sigaction (SIGHUP, &sa, NULL);
+ sigaction (SIGINT, &sa, NULL);
+ sigaction (SIGQUIT, &sa, NULL);
+ sigaction (SIGTERM, &sa, NULL);
+ sigaction (SIGUSR1, &sa, NULL);
+ sigaction (SIGWINCH, &sa, NULL);
/* Unmask signals */
- do_sigprocmask (SIG_SETMASK, &empty, NULL);
+ sigprocmask (SIG_SETMASK, &empty, NULL);
/* Safe to run now */
execl (file, file, arg, (char *) NULL);