aboutsummaryrefslogtreecommitdiff
path: root/src/librc/librc.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-02-02 00:38:06 +0000
committerRoy Marples <roy@marples.name>2008-02-02 00:38:06 +0000
commite2919519d77836132dca6140d8d23a24a7631a18 (patch)
tree5ad6c2d8a63fab986df896d1dd1546d510739071 /src/librc/librc.c
parentad045176238549c3267fff3e8c0014dd5e9ffbdf (diff)
Using syscall in a vfork is safe for sigaction and sigprogmask.
Diffstat (limited to 'src/librc/librc.c')
-rw-r--r--src/librc/librc.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/librc/librc.c b/src/librc/librc.c
index 1cd3eec5..669c27f5 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -32,6 +32,7 @@
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"
@@ -606,18 +607,18 @@ static pid_t _exec_service (const char *service, const char *arg)
sigfillset (&full);
sigprocmask (SIG_SETMASK, &full, &old);
- if ((pid = fork ()) == 0) {
+ if ((pid = vfork ()) == 0) {
/* Restore default handlers */
- 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);
+ syscall (SYS_sigaction, SIGCHLD, &sa, NULL);
+ syscall (SYS_sigaction, SIGHUP, &sa, NULL);
+ syscall (SYS_sigaction, SIGINT, &sa, NULL);
+ syscall (SYS_sigaction, SIGQUIT, &sa, NULL);
+ syscall (SYS_sigaction, SIGTERM, &sa, NULL);
+ syscall (SYS_sigaction, SIGUSR1, &sa, NULL);
+ syscall (SYS_sigaction, SIGWINCH, &sa, NULL);
/* Unmask signals */
- sigprocmask (SIG_SETMASK, &empty, NULL);
+ syscall (SYS_sigprocmask, SIG_SETMASK, &empty, NULL);
/* Safe to run now */
execl (file, file, arg, (char *) NULL);