summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Gusarov <dottedmag@dottedmag.net>2010-04-14 03:03:26 +0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2010-04-13 20:17:25 -0700
commit15cf3d560ab5b6847d8891208080ac964c1682fb (patch)
tree1a1d000afdb5835e8cd47174c06163ddf5e3e4c2
parentfa009dcc191e1d70937e5fb4dd8ae8d9c151a607 (diff)
Use sigaction(2) instead of signal(2) to handle SIGUSR1 and SIGALRM
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xinit.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/xinit.c b/xinit.c
index 66d5475..eaf4da1 100644
--- a/xinit.c
+++ b/xinit.c
@@ -137,19 +137,8 @@ sigCatch(int sig)
}
static SIGVAL
-sigAlarm(int sig)
+sigIgnore(int sig)
{
-#if defined(SYSV) || defined(SVR4) || defined(linux) || defined(__APPLE__)
- signal(sig, sigAlarm);
-#endif
-}
-
-static SIGVAL
-sigUsr1(int sig)
-{
-#if defined(SYSV) || defined(SVR4) || defined(linux) || defined(__APPLE__)
- signal(sig, sigUsr1);
-#endif
}
static void
@@ -174,7 +163,7 @@ main(int argc, char *argv[])
int client_given = 0, server_given = 0;
int client_args_given = 0, server_args_given = 0;
int start_of_client_args, start_of_server_args;
- struct sigaction sa;
+ struct sigaction sa, si;
#ifdef __APPLE__
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
vproc_transaction_t vt;
@@ -301,8 +290,13 @@ main(int argc, char *argv[])
sigaction(SIGHUP, &sa, NULL);
sigaction(SIGPIPE, &sa, NULL);
- signal(SIGALRM, sigAlarm);
- signal(SIGUSR1, sigUsr1);
+ memset(&si, 0, sizeof(si));
+ si.sa_handler = sigIgnore;
+ sigemptyset(&si.sa_mask);
+ si.sa_flags = SA_RESTART;
+
+ sigaction(SIGALRM, &si, NULL);
+ sigaction(SIGUSR1, &si, NULL);
#ifdef __APPLE__
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060