summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-04-02 20:48:19 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-04-02 20:48:19 +0000
commit47fd8112b5ad0e83d895e5be9342b70832ea3075 (patch)
tree8a72a7bd0295430d833bd1b6469dfabd5616dc6a
parent03f3932829d5246d41c26b3d9f9482c618356430 (diff)
- markus@cvs.openbsd.org 2002/03/30 18:51:15
[monitor.c serverloop.c sftp-int.c sftp.c sshd.c] check waitpid for EINTR; based on patch from peter@ifm.liu.se
-rw-r--r--ChangeLog5
-rw-r--r--monitor.c7
-rw-r--r--serverloop.c16
-rw-r--r--sftp-int.c7
-rw-r--r--sftp.c8
-rw-r--r--sshd.c11
6 files changed, 33 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index edfb4506e..391eb00e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,9 @@
19 - stevesk@cvs.openbsd.org 2002/03/29 19:18:33 19 - stevesk@cvs.openbsd.org 2002/03/29 19:18:33
20 [auth-rsa.c ssh-rsa.c ssh.h] 20 [auth-rsa.c ssh-rsa.c ssh.h]
21 make RSA modulus minimum #define; ok markus@ 21 make RSA modulus minimum #define; ok markus@
22 - markus@cvs.openbsd.org 2002/03/30 18:51:15
23 [monitor.c serverloop.c sftp-int.c sftp.c sshd.c]
24 check waitpid for EINTR; based on patch from peter@ifm.liu.se
22 25
2320020401 2620020401
24 - (stevesk) [monitor.c] PAM should work again; will *not* work with 27 - (stevesk) [monitor.c] PAM should work again; will *not* work with
@@ -8126,4 +8129,4 @@
8126 - Wrote replacements for strlcpy and mkdtemp 8129 - Wrote replacements for strlcpy and mkdtemp
8127 - Released 1.0pre1 8130 - Released 1.0pre1
8128 8131
8129$Id: ChangeLog,v 1.2012 2002/04/02 20:43:11 mouring Exp $ 8132$Id: ChangeLog,v 1.2013 2002/04/02 20:48:19 mouring Exp $
diff --git a/monitor.c b/monitor.c
index 7b4e53eb5..03f8dc74a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: monitor.c,v 1.8 2002/03/27 17:45:42 mouring Exp $"); 28RCSID("$OpenBSD: monitor.c,v 1.9 2002/03/30 18:51:15 markus Exp $");
29 29
30#include <openssl/dh.h> 30#include <openssl/dh.h>
31 31
@@ -1211,8 +1211,9 @@ mm_answer_term(int socket, Buffer *req)
1211 /* The child is terminating */ 1211 /* The child is terminating */
1212 session_destroy_all(&mm_session_close); 1212 session_destroy_all(&mm_session_close);
1213 1213
1214 if (waitpid(monitor->m_pid, &status, 0) == -1) 1214 while (waitpid(monitor->m_pid, &status, 0) == -1)
1215 exit(1); 1215 if (errno != EINTR)
1216 exit(1);
1216 1217
1217 res = WIFEXITED(status) ? WEXITSTATUS(status) : 1; 1218 res = WIFEXITED(status) ? WEXITSTATUS(status) : 1;
1218 1219
diff --git a/serverloop.c b/serverloop.c
index cacf0ad42..38b1cf7ba 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: serverloop.c,v 1.100 2002/03/24 16:00:27 markus Exp $"); 38RCSID("$OpenBSD: serverloop.c,v 1.101 2002/03/30 18:51:15 markus Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "packet.h" 41#include "packet.h"
@@ -670,10 +670,10 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
670 /* We no longer want our SIGCHLD handler to be called. */ 670 /* We no longer want our SIGCHLD handler to be called. */
671 mysignal(SIGCHLD, SIG_DFL); 671 mysignal(SIGCHLD, SIG_DFL);
672 672
673 wait_pid = waitpid(-1, &wait_status, 0); 673 while ((wait_pid = waitpid(-1, &wait_status, 0)) < 0)
674 if (wait_pid == -1) 674 if (errno != EINTR)
675 packet_disconnect("wait: %.100s", strerror(errno)); 675 packet_disconnect("wait: %.100s", strerror(errno));
676 else if (wait_pid != pid) 676 if (wait_pid != pid)
677 error("Strange, wait returned pid %d, expected %d", 677 error("Strange, wait returned pid %d, expected %d",
678 wait_pid, pid); 678 wait_pid, pid);
679 679
@@ -723,8 +723,10 @@ collect_children(void)
723 sigaddset(&nset, SIGCHLD); 723 sigaddset(&nset, SIGCHLD);
724 sigprocmask(SIG_BLOCK, &nset, &oset); 724 sigprocmask(SIG_BLOCK, &nset, &oset);
725 if (child_terminated) { 725 if (child_terminated) {
726 while ((pid = waitpid(-1, &status, WNOHANG)) > 0) 726 while ((pid = waitpid(-1, &status, WNOHANG)) > 0 ||
727 session_close_by_pid(pid, status); 727 (pid < 0 && errno == EINTR))
728 if (pid > 0)
729 session_close_by_pid(pid, status);
728 child_terminated = 0; 730 child_terminated = 0;
729 } 731 }
730 sigprocmask(SIG_SETMASK, &oset, NULL); 732 sigprocmask(SIG_SETMASK, &oset, NULL);
diff --git a/sftp-int.c b/sftp-int.c
index 46cbd4a12..5b1d3848e 100644
--- a/sftp-int.c
+++ b/sftp-int.c
@@ -26,7 +26,7 @@
26/* XXX: recursive operations */ 26/* XXX: recursive operations */
27 27
28#include "includes.h" 28#include "includes.h"
29RCSID("$OpenBSD: sftp-int.c,v 1.45 2002/03/19 06:32:56 mpech Exp $"); 29RCSID("$OpenBSD: sftp-int.c,v 1.46 2002/03/30 18:51:15 markus Exp $");
30 30
31#include "buffer.h" 31#include "buffer.h"
32#include "xmalloc.h" 32#include "xmalloc.h"
@@ -176,8 +176,9 @@ local_do_shell(const char *args)
176 strerror(errno)); 176 strerror(errno));
177 _exit(1); 177 _exit(1);
178 } 178 }
179 if (waitpid(pid, &status, 0) == -1) 179 while (waitpid(pid, &status, 0) == -1)
180 fatal("Couldn't wait for child: %s", strerror(errno)); 180 if (errno != EINTR)
181 fatal("Couldn't wait for child: %s", strerror(errno));
181 if (!WIFEXITED(status)) 182 if (!WIFEXITED(status))
182 error("Shell exited abormally"); 183 error("Shell exited abormally");
183 else if (WEXITSTATUS(status)) 184 else if (WEXITSTATUS(status))
diff --git a/sftp.c b/sftp.c
index f576ed3d5..e4086549c 100644
--- a/sftp.c
+++ b/sftp.c
@@ -24,7 +24,7 @@
24 24
25#include "includes.h" 25#include "includes.h"
26 26
27RCSID("$OpenBSD: sftp.c,v 1.27 2002/03/19 10:49:35 markus Exp $"); 27RCSID("$OpenBSD: sftp.c,v 1.28 2002/03/30 18:51:15 markus Exp $");
28 28
29/* XXX: short-form remote directory listings (like 'ls -C') */ 29/* XXX: short-form remote directory listings (like 'ls -C') */
30 30
@@ -246,8 +246,10 @@ main(int argc, char **argv)
246 if (infile != stdin) 246 if (infile != stdin)
247 fclose(infile); 247 fclose(infile);
248 248
249 if (waitpid(sshpid, NULL, 0) == -1) 249 while (waitpid(sshpid, NULL, 0) == -1)
250 fatal("Couldn't wait for ssh process: %s", strerror(errno)); 250 if (errno != EINTR)
251 fatal("Couldn't wait for ssh process: %s",
252 strerror(errno));
251 253
252 exit(0); 254 exit(0);
253} 255}
diff --git a/sshd.c b/sshd.c
index 541e9932e..2e21d3d4e 100644
--- a/sshd.c
+++ b/sshd.c
@@ -42,7 +42,7 @@
42 */ 42 */
43 43
44#include "includes.h" 44#include "includes.h"
45RCSID("$OpenBSD: sshd.c,v 1.238 2002/03/23 20:57:26 stevesk Exp $"); 45RCSID("$OpenBSD: sshd.c,v 1.239 2002/03/30 18:51:15 markus Exp $");
46 46
47#include <openssl/dh.h> 47#include <openssl/dh.h>
48#include <openssl/bn.h> 48#include <openssl/bn.h>
@@ -276,10 +276,12 @@ sigterm_handler(int sig)
276static void 276static void
277main_sigchld_handler(int sig) 277main_sigchld_handler(int sig)
278{ 278{
279 pid_t pid;
279 int save_errno = errno; 280 int save_errno = errno;
280 int status; 281 int status;
281 282
282 while (waitpid(-1, &status, WNOHANG) > 0) 283 while ((pid = waitpid(-1, &status, WNOHANG)) > 0 ||
284 (pid < 0 && errno == EINTR))
283 ; 285 ;
284 286
285 signal(SIGCHLD, main_sigchld_handler); 287 signal(SIGCHLD, main_sigchld_handler);
@@ -577,8 +579,9 @@ privsep_preauth(void)
577 monitor_sync(monitor); 579 monitor_sync(monitor);
578 580
579 /* Wait for the child's exit status */ 581 /* Wait for the child's exit status */
580 waitpid(pid, &status, 0); 582 while (waitpid(pid, &status, 0) < 0)
581 583 if (errno != EINTR)
584 break;
582 return (authctxt); 585 return (authctxt);
583 } else { 586 } else {
584 /* child */ 587 /* child */