summaryrefslogtreecommitdiff
path: root/entropy.c
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 /entropy.c
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 'entropy.c')
-rw-r--r--entropy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/entropy.c b/entropy.c
index 5de68016b..2eebadf4a 100644
--- a/entropy.c
+++ b/entropy.c
@@ -110,7 +110,7 @@ get_random_bytes_prngd(unsigned char *buf, int len,
110 strlen(socket_path) + 1; 110 strlen(socket_path) + 1;
111 } 111 }
112 112
113 old_sigpipe = signal(SIGPIPE, SIG_IGN); 113 old_sigpipe = ssh_signal(SIGPIPE, SIG_IGN);
114 114
115 errors = 0; 115 errors = 0;
116 rval = -1; 116 rval = -1;
@@ -160,7 +160,7 @@ reopen:
160 160
161 rval = 0; 161 rval = 0;
162done: 162done:
163 signal(SIGPIPE, old_sigpipe); 163 ssh_signal(SIGPIPE, old_sigpipe);
164 if (fd != -1) 164 if (fd != -1)
165 close(fd); 165 close(fd);
166 return rval; 166 return rval;