summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/jobs.c2
-rw-r--r--src/trap.c2
-rw-r--r--src/trap.h2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/jobs.c b/src/jobs.c
index 0926360..d4c13c0 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -1136,7 +1136,6 @@ static int dowait(int block, struct job *jp)
 	rpid = 1;
 
 	do {
-		gotsigchld = 0;
 		pid = waitone(block, jp);
 		rpid &= !!pid;
 
@@ -1176,6 +1175,7 @@ waitproc(int block, int *status)
 #endif
 
 	do {
+		gotsigchld = 0;
 		do
 			err = wait3(status, flags, NULL);
 		while (err < 0 && errno == EINTR);
diff --git a/src/trap.c b/src/trap.c
index 82e7ece..cd84814 100644
--- a/src/trap.c
+++ b/src/trap.c
@@ -76,7 +76,7 @@ static char gotsig[NSIG - 1];
 /* last pending signal */
 volatile sig_atomic_t pending_sig;
 /* received SIGCHLD */
-int gotsigchld;
+volatile sig_atomic_t gotsigchld;
 
 extern char *signal_names[];
 
diff --git a/src/trap.h b/src/trap.h
index 4c455a8..beaf660 100644
--- a/src/trap.h
+++ b/src/trap.h
@@ -39,7 +39,7 @@
 extern int trapcnt;
 extern char sigmode[];
 extern volatile sig_atomic_t pending_sig;
-extern int gotsigchld;
+extern volatile sig_atomic_t gotsigchld;
 
 int trapcmd(int, char **);
 void setsignal(int);