diff options
author | Darren Tucker <dtucker@dtucker.net> | 2021-08-20 00:39:33 +0200 |
---|---|---|
committer | Darren Tucker <dtucker@dtucker.net> | 2021-08-20 00:39:33 +0200 |
commit | deaadcb93ca15d4f38aa38fb340156077792ce87 (patch) | |
tree | 297aeeb1a61ad51942b23511b72ac5d181b9fb5a | |
parent | Fix race in pselect replacement code. (diff) | |
download | openssh-deaadcb93ca15d4f38aa38fb340156077792ce87.tar.xz openssh-deaadcb93ca15d4f38aa38fb340156077792ce87.zip |
Prefix pselect functions to clarify debug messages
-rw-r--r-- | openbsd-compat/bsd-pselect.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/openbsd-compat/bsd-pselect.c b/openbsd-compat/bsd-pselect.c index 983427aae..1d4140a53 100644 --- a/openbsd-compat/bsd-pselect.c +++ b/openbsd-compat/bsd-pselect.c @@ -58,7 +58,7 @@ static sighandler_t saved_sighandler[_NSIG]; */ #define REEXEC_MIN_FREE_FD (STDERR_FILENO + 4) static int -notify_setup_fd(int *fd) +pselect_notify_setup_fd(int *fd) { int r; @@ -76,7 +76,7 @@ notify_setup_fd(int *fd) static pid_t notify_pid; static int notify_pipe[2]; static void -notify_setup(void) +pselect_notify_setup(void) { static int initialized; @@ -93,8 +93,8 @@ notify_setup(void) } if (pipe(notify_pipe) == -1) { error("pipe(notify_pipe) failed %s", strerror(errno)); - } else if (notify_setup_fd(¬ify_pipe[0]) == -1 || - notify_setup_fd(¬ify_pipe[1]) == -1) { + } else if (pselect_notify_setup_fd(¬ify_pipe[0]) == -1 || + pselect_notify_setup_fd(¬ify_pipe[1]) == -1) { error("fcntl(notify_pipe, ...) failed %s", strerror(errno)); close(notify_pipe[0]); close(notify_pipe[1]); @@ -111,19 +111,19 @@ notify_setup(void) notify_pipe[1] = -1; /* write end */ } static void -notify_parent(void) +pselect_notify_parent(void) { if (notify_pipe[1] != -1) (void)write(notify_pipe[1], "", 1); } static void -notify_prepare(fd_set *readset) +pselect_notify_prepare(fd_set *readset) { if (notify_pipe[0] != -1) FD_SET(notify_pipe[0], readset); } static void -notify_done(fd_set *readset) +pselect_notify_done(fd_set *readset) { char c; @@ -136,11 +136,11 @@ notify_done(fd_set *readset) /*ARGSUSED*/ static void -sig_handler(int sig) +pselect_sig_handler(int sig) { int save_errno = errno; - notify_parent(); + pselect_notify_parent(); if (saved_sighandler[sig] != NULL) (*saved_sighandler[sig])(sig); /* call original handler */ errno = save_errno; @@ -174,9 +174,9 @@ pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, if (sigaction(sig, NULL, &sa) == 0 && sa.sa_handler != SIG_IGN && sa.sa_handler != SIG_DFL) { unmasked = 1; - if (sa.sa_handler == sig_handler) + if (sa.sa_handler == pselect_sig_handler) continue; - sa.sa_handler = sig_handler; + sa.sa_handler = pselect_sig_handler; if (sigaction(sig, &sa, &osa) == 0) { debug3_f("installing signal handler for %s, " "previous %p", strsignal(sig), @@ -186,8 +186,8 @@ pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, } } if (unmasked) { - notify_setup(); - notify_prepare(readfds); + pselect_notify_setup(); + pselect_notify_prepare(readfds); nfds = MAX(nfds, notify_pipe[0]); } @@ -198,7 +198,7 @@ pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, sigprocmask(SIG_SETMASK, &osig, NULL); if (unmasked) - notify_done(readfds); + pselect_notify_done(readfds); errno = saved_errno; return ret; } |