aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-05-02 21:48:17 +0000
committerMatt Kraai <kraai@debian.org>2001-05-02 21:48:17 +0000
commit80abc45182ff8a526968d199add198f979875c77 (patch)
treeda6cf3cde215f3616ffd65d3e5ee77471ef4cc68
parentadcbc12d85b91929b73f3897bff7d1559aa39c51 (diff)
downloadbusybox-w32-80abc45182ff8a526968d199add198f979875c77.tar.gz
busybox-w32-80abc45182ff8a526968d199add198f979875c77.tar.bz2
busybox-w32-80abc45182ff8a526968d199add198f979875c77.zip
Move up waitpid error check so that errno isn't clobbered by tcsetpgrp.
-rw-r--r--hush.c6
-rw-r--r--shell/hush.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/hush.c b/hush.c
index 4a16a3fa6..a7316f82e 100644
--- a/hush.c
+++ b/hush.c
@@ -1148,12 +1148,12 @@ static void checkjobs()
1148 } 1148 }
1149 } 1149 }
1150 1150
1151 if (childpid == -1 && errno != ECHILD)
1152 perror_msg("waitpid");
1153
1151 /* move the shell to the foreground */ 1154 /* move the shell to the foreground */
1152 if (tcsetpgrp(0, getpgrp()) && errno != ENOTTY) 1155 if (tcsetpgrp(0, getpgrp()) && errno != ENOTTY)
1153 perror_msg("tcsetpgrp"); 1156 perror_msg("tcsetpgrp");
1154
1155 if (childpid == -1 && errno != ECHILD)
1156 perror_msg("waitpid");
1157} 1157}
1158 1158
1159/* run_pipe_real() starts all the jobs, but doesn't wait for anything 1159/* run_pipe_real() starts all the jobs, but doesn't wait for anything
diff --git a/shell/hush.c b/shell/hush.c
index 4a16a3fa6..a7316f82e 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -1148,12 +1148,12 @@ static void checkjobs()
1148 } 1148 }
1149 } 1149 }
1150 1150
1151 if (childpid == -1 && errno != ECHILD)
1152 perror_msg("waitpid");
1153
1151 /* move the shell to the foreground */ 1154 /* move the shell to the foreground */
1152 if (tcsetpgrp(0, getpgrp()) && errno != ENOTTY) 1155 if (tcsetpgrp(0, getpgrp()) && errno != ENOTTY)
1153 perror_msg("tcsetpgrp"); 1156 perror_msg("tcsetpgrp");
1154
1155 if (childpid == -1 && errno != ECHILD)
1156 perror_msg("waitpid");
1157} 1157}
1158 1158
1159/* run_pipe_real() starts all the jobs, but doesn't wait for anything 1159/* run_pipe_real() starts all the jobs, but doesn't wait for anything