]> andersk Git - openssh.git/blobdiff - openbsd-compat/bsd-misc.c
- (bal) "extration" -> "extraction" in ssh-rand-helper.c; repoted by john
[openssh.git] / openbsd-compat / bsd-misc.c
index db9c47713206fbb0ed976dc2c22e41ae041c72b8..4373ce24aeaaef2eb19cc015d06f79669a6fcd56 100644 (file)
@@ -31,7 +31,7 @@ RCSID("$Id$");
  * NB. duplicate __progname in case it is an alias for argv[0]
  * Otherwise it may get clobbered by setproctitle()
  */
-char *get_progname(char *argv0)
+char *ssh_get_progname(char *argv0)
 {
 #ifdef HAVE___PROGNAME
        extern char *__progname;
@@ -200,3 +200,29 @@ tcsendbreak(int fd, int duration)
 # endif
 }
 #endif /* HAVE_TCSENDBREAK */
+
+mysig_t
+mysignal(int sig, mysig_t act)
+{
+#ifdef HAVE_SIGACTION
+       struct sigaction sa, osa;
+
+       if (sigaction(sig, NULL, &osa) == -1)
+               return (mysig_t) -1;
+       if (osa.sa_handler != act) {
+               memset(&sa, 0, sizeof(sa));
+               sigemptyset(&sa.sa_mask);
+               sa.sa_flags = 0;
+#ifdef SA_INTERRUPT
+               if (sig == SIGALRM)
+                       sa.sa_flags |= SA_INTERRUPT;
+#endif
+               sa.sa_handler = act;
+               if (sigaction(sig, &sa, NULL) == -1)
+                       return (mysig_t) -1;
+       }
+       return (osa.sa_handler);
+#else
+       return (signal(sig, act));
+#endif
+}
This page took 2.52097 seconds and 4 git commands to generate.