- (djm) Bug #621: Select OpenSC keys by usage attributes. Patch from
larsch@trustcenter.de
- (bal) openbsd-compat/ OpenBSD updates. Mostly licensing, ansifications
- and minor fixes.
+ and minor fixes. OK djm@
+ - (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@
20030822
- (djm) s/get_progname/ssh_get_progname/g to avoid conflict with Heimdal
if (pipe(p) == -1)
fatal("pipe: %s", strerror(errno));
- old_sigchld = mysignal(SIGCHLD, SIG_DFL);
+ old_sigchld = signal(SIGCHLD, SIG_DFL);
if ((pid = fork()) == -1)
fatal("Couldn't fork: %s", strerror(errno));
if (pid == 0) {
if (waitpid(pid, &ret, 0) == -1)
fatal("Couldn't wait for ssh-rand-helper completion: %s",
strerror(errno));
- mysignal(SIGCHLD, old_sigchld);
+ signal(SIGCHLD, old_sigchld);
/* We don't mind if the child exits upon a SIGPIPE */
if (!WIFEXITED(ret) &&
args->list[args->num++] = xstrdup(buf);
args->list[args->num] = NULL;
}
-
-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;
-#if defined(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
-}
int nalloc;
};
void addargs(arglist *, char *, ...) __attribute__((format(printf, 2, 3)));
-
-/* wrapper for signal interface */
-typedef void (*mysig_t)(int);
-mysig_t mysignal(int sig, mysig_t act);
# 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
+}
int tcsendbreak(int, int);
#endif
+/* wrapper for signal interface */
+typedef void (*mysig_t)(int);
+mysig_t mysignal(int sig, mysig_t act);
+
+#define signal(a,b) mysignal(a,b)
+
#endif /* _BSD_MISC_H */
if (can_output())
refresh_progress_meter();
- mysignal(SIGALRM, update_progress_meter);
+ signal(SIGALRM, update_progress_meter);
alarm(UPDATE_INTERVAL);
errno = save_errno;
}
if (can_output())
refresh_progress_meter();
- mysignal(SIGALRM, update_progress_meter);
+ signal(SIGALRM, update_progress_meter);
alarm(UPDATE_INTERVAL);
}
if ((options.protocol & SSH_PROTO_1) &&
key_used == 0) {
/* Schedule server key regeneration alarm. */
- mysignal(SIGALRM, key_regeneration_alarm);
+ signal(SIGALRM, key_regeneration_alarm);
alarm(options.key_regeneration_time);
key_used = 1;
}
* mode; it is just annoying to have the server exit just when you
* are about to discover the bug.
*/
- mysignal(SIGALRM, grace_alarm_handler);
+ signal(SIGALRM, grace_alarm_handler);
if (!debug_flag)
alarm(options.login_grace_time);
error("/dev/ptmx: %.100s", strerror(errno));
return 0;
}
- old_signal = mysignal(SIGCHLD, SIG_DFL);
+ old_signal = signal(SIGCHLD, SIG_DFL);
if (grantpt(ptm) < 0) {
error("grantpt: %.100s", strerror(errno));
return 0;
}
- mysignal(SIGCHLD, old_signal);
+ signal(SIGCHLD, old_signal);
if (unlockpt(ptm) < 0) {
error("unlockpt: %.100s", strerror(errno));
return 0;
fd = open(ttyname, O_RDWR|O_NOCTTY);
if (fd != -1) {
- mysignal(SIGHUP, SIG_IGN);
+ signal(SIGHUP, SIG_IGN);
ioctl(fd, TCVHUP, (char *)NULL);
- mysignal(SIGHUP, SIG_DFL);
+ signal(SIGHUP, SIG_DFL);
setpgid(0, 0);
close(fd);
} else {
error("SETPGRP %s",strerror(errno));
#endif /* HAVE_NEWS4 */
#ifdef USE_VHANGUP
- old = mysignal(SIGHUP, SIG_IGN);
+ old = signal(SIGHUP, SIG_IGN);
vhangup();
- mysignal(SIGHUP, old);
+ signal(SIGHUP, old);
#endif /* USE_VHANGUP */
fd = open(ttyname, O_RDWR);
if (fd < 0) {