diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2011-06-08 10:01:14 +0300 |
---|---|---|
committer | Panu Matilainen <Panu Matilainen pmatilai@redhat.com> | 2011-07-15 12:19:28 +0300 |
commit | 4897a01066ae0dce4d8737abe4f0c7ed9c85d74b (patch) | |
tree | 9c91d560917c193b62c1e9087d74234c7c748ecf | |
parent | 8210b0a4d7f859687022a2f66ff7280566dff329 (diff) | |
download | rpm-4897a01066ae0dce4d8737abe4f0c7ed9c85d74b.tar.gz |
Abort depgen output reading on EOF, not child exiting
- There could, at least in theory, still be data to read after
we receive SIGCHLD. Stop the loop on EOF on read instead.
Thanks to Michael Schroeder for pointing this out.
(cherry picked from commit fb3412e80b52b19d51557b81b318b85f785acffd)
-rw-r--r-- | build/rpmfc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/build/rpmfc.c b/build/rpmfc.c index 4958f3eb0..82e654f16 100644 --- a/build/rpmfc.c +++ b/build/rpmfc.c @@ -305,6 +305,7 @@ static StringBuf getOutputFrom(ARGV_t argv, /* Read when we get data back from the child */ if (FD_ISSET(fromProg[0], &ibits)) { int nbr = read(fromProg[0], buf, sizeof(buf)-1); + if (nbr == 0) break; /* EOF, we're done */ if (nbr < 0 && errno == EINTR) continue; if (nbr < 0) { myerrno = errno; @@ -314,10 +315,9 @@ static StringBuf getOutputFrom(ARGV_t argv, appendStringBuf(readBuff, buf); } - /* Child exited, we're done */ + /* Child exited */ if (FD_ISSET(sigpipe, &ibits)) { while (read(sigpipe, buf, sizeof(buf)) > 0) {}; - break; } } |