diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2003-08-25 01:16:21 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2003-08-25 01:16:21 +0000 |
commit | 5ade9abc37df3dacacbe20104877ca6dab61082a (patch) | |
tree | b3a521b87d93ecc0f1f17f4e659c1d4bf90f86f5 /misc.c | |
parent | af4a6c3a5619299a16cfbb545cde110849596204 (diff) |
- (bal) redo how we handle 'mysignal()'. Move it to
openbsd-compat/bsd-misc.c, s/mysignal/signal/ and #define signal to
be our 'mysignal' by default. OK djm@
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 26 |
1 files changed, 0 insertions, 26 deletions
@@ -323,29 +323,3 @@ addargs(arglist *args, char *fmt, ...) | |||
323 | args->list[args->num++] = xstrdup(buf); | 323 | args->list[args->num++] = xstrdup(buf); |
324 | args->list[args->num] = NULL; | 324 | args->list[args->num] = NULL; |
325 | } | 325 | } |
326 | |||
327 | mysig_t | ||
328 | mysignal(int sig, mysig_t act) | ||
329 | { | ||
330 | #ifdef HAVE_SIGACTION | ||
331 | struct sigaction sa, osa; | ||
332 | |||
333 | if (sigaction(sig, NULL, &osa) == -1) | ||
334 | return (mysig_t) -1; | ||
335 | if (osa.sa_handler != act) { | ||
336 | memset(&sa, 0, sizeof(sa)); | ||
337 | sigemptyset(&sa.sa_mask); | ||
338 | sa.sa_flags = 0; | ||
339 | #if defined(SA_INTERRUPT) | ||
340 | if (sig == SIGALRM) | ||
341 | sa.sa_flags |= SA_INTERRUPT; | ||
342 | #endif | ||
343 | sa.sa_handler = act; | ||
344 | if (sigaction(sig, &sa, NULL) == -1) | ||
345 | return (mysig_t) -1; | ||
346 | } | ||
347 | return (osa.sa_handler); | ||
348 | #else | ||
349 | return (signal(sig, act)); | ||
350 | #endif | ||
351 | } | ||