summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClint Adams <clint@debian.org>2013-01-30 21:02:01 -0500
committerClint Adams <clint@debian.org>2013-01-30 21:02:01 -0500
commitca21faeb076f64d82b4b7b16b63d7ea747390b28 (patch)
tree7e372fd1343a386144a308df3d83f8039e8f0ecd
parent603ab8b2d39a2a1f8bb19df2f8aae3cd1b56d269 (diff)
downloaddebianutils-ca21faeb076f64d82b4b7b16b63d7ea747390b28.tar.gz
Patch from Robert Collins to fix compiler warnings. closes: #699315.
-rw-r--r--run-parts.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/run-parts.c b/run-parts.c
index 7bc8d49..a4f0c65 100644
--- a/run-parts.c
+++ b/run-parts.c
@@ -255,6 +255,16 @@ void run_part(char *progname)
exit(1);
}
else if (r > 0) {
+ /* If STDOUT or STDERR get closed / full, we still run to completion
+ * (and just ignore that we can't output process output any more).
+ * Perhaps we should instead kill the child process we are running
+ * if that happens.
+ * For now partial writes are not retried to complete - that can
+ * and should be done, but needs care to ensure that we don't hang
+ * if the fd doesn't accept more data ever - or we need to decide that
+ * waiting is the appropriate thing to do.
+ */
+ int ignored;
if (pout[0] >= 0 && FD_ISSET(pout[0], &set)) {
c = read(pout[0], buf, sizeof(buf));
if (c > 0) {
@@ -263,7 +273,7 @@ void run_part(char *progname)
fflush(stdout);
printflag = 1;
}
- write(STDOUT_FILENO, buf, c);
+ ignored = write(STDOUT_FILENO, buf, c);
}
else if (c == 0) {
close(pout[0]);
@@ -283,7 +293,7 @@ void run_part(char *progname)
fflush(stderr);
printflag = 1;
}
- write(STDERR_FILENO, buf, c);
+ ignored = write(STDERR_FILENO, buf, c);
}
else if (c == 0) {
close(perr[0]);