summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/misc.c b/misc.c
index 512fb22fb..c457a952c 100644
--- a/misc.c
+++ b/misc.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: misc.c,v 1.20 2002/12/13 10:03:15 markus Exp $"); 26RCSID("$OpenBSD: misc.c,v 1.21 2003/04/12 10:15:36 markus Exp $");
27 27
28#include "misc.h" 28#include "misc.h"
29#include "log.h" 29#include "log.h"
@@ -60,7 +60,7 @@ set_nonblock(int fd)
60 debug2("fd %d is O_NONBLOCK", fd); 60 debug2("fd %d is O_NONBLOCK", fd);
61 return; 61 return;
62 } 62 }
63 debug("fd %d setting O_NONBLOCK", fd); 63 debug2("fd %d setting O_NONBLOCK", fd);
64 val |= O_NONBLOCK; 64 val |= O_NONBLOCK;
65 if (fcntl(fd, F_SETFL, val) == -1) 65 if (fcntl(fd, F_SETFL, val) == -1)
66 debug("fcntl(%d, F_SETFL, O_NONBLOCK): %s", 66 debug("fcntl(%d, F_SETFL, O_NONBLOCK): %s",
@@ -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
327mysig_t
328mysignal(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}