summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2020-01-23 07:10:22 +0000
committerDarren Tucker <dtucker@dtucker.net>2020-01-23 18:51:25 +1100
commit3bf2a6ac791d64046a537335a0f1d5e43579c5ad (patch)
tree76fcc0f1be306541c074be4aed3aca66023f0962 /openbsd-compat
parente027c044c796f3a01081a91bee55741204283f28 (diff)
upstream: Replace all calls to signal(2) with a wrapper around
sigaction(2). This wrapper blocks all other signals during the handler preventing races between handlers, and sets SA_RESTART which should reduce the potential for short read/write operations. OpenBSD-Commit-ID: 5e047663fd77a40d7b07bdabe68529df51fd2519
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/bsd-openpty.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/openbsd-compat/bsd-openpty.c b/openbsd-compat/bsd-openpty.c
index 123a9be56..b6b5ab49b 100644
--- a/openbsd-compat/bsd-openpty.c
+++ b/openbsd-compat/bsd-openpty.c
@@ -103,10 +103,10 @@ openpty(int *amaster, int *aslave, char *name, struct termios *termp,
103 return (-1); 103 return (-1);
104 104
105 /* XXX: need to close ptm on error? */ 105 /* XXX: need to close ptm on error? */
106 old_signal = signal(SIGCHLD, SIG_DFL); 106 old_signal = ssh_signal(SIGCHLD, SIG_DFL);
107 if (grantpt(ptm) < 0) 107 if (grantpt(ptm) < 0)
108 return (-1); 108 return (-1);
109 signal(SIGCHLD, old_signal); 109 ssh_signal(SIGCHLD, old_signal);
110 110
111 if (unlockpt(ptm) < 0) 111 if (unlockpt(ptm) < 0)
112 return (-1); 112 return (-1);