]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Re-add SA_RESTART to mysignal.
authorDarren Tucker <dtucker@dtucker.net>
Fri, 11 Oct 2019 03:12:16 +0000 (14:12 +1100)
committerDarren Tucker <dtucker@dtucker.net>
Fri, 11 Oct 2019 03:12:16 +0000 (14:12 +1100)
This makes mysignal implement reliable BSD semantics according to
Stevens' APUE.  This was first attempted in 2001 but was reverted
due to problems with HP-UX 10.20 and select() and possibly grantpt().
Modern systems should be fine with it, but if any current platforms have
a problem with it now we can disable it just for those.  ok djm@

openbsd-compat/bsd-signal.c

index 0b816a3a635c5eaed092211cde1db04b4769b1c4..104ab653f50b59231834ca9fea42fc7a965093a4 100644 (file)
@@ -37,10 +37,15 @@ mysignal(int sig, mysig_t act)
                memset(&sa, 0, sizeof(sa));
                sigemptyset(&sa.sa_mask);
                sa.sa_flags = 0;
+               if (sig == SIGALRM) {
 #ifdef SA_INTERRUPT
-               if (sig == SIGALRM)
                        sa.sa_flags |= SA_INTERRUPT;
 #endif
+               } else {
+#ifdef SA_RESTART
+                       sa.sa_flags |= SA_RESTART;
+#endif
+               }
                sa.sa_handler = act;
                if (sigaction(sig, &sa, NULL) == -1)
                        return (mysig_t) -1;