projects
/
tools
/
librpm-tizen.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bc05972
)
Abort depgen output reading on EOF, not child exiting
author
Panu Matilainen
<pmatilai@redhat.com>
Wed, 8 Jun 2011 07:01:14 +0000
(10:01 +0300)
committer
Panu Matilainen
<pmatilai@redhat.com>
Wed, 8 Jun 2011 07:01:14 +0000
(10:01 +0300)
- 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.
build/rpmfc.c
patch
|
blob
|
history
diff --git
a/build/rpmfc.c
b/build/rpmfc.c
index
a01cba2
..
70eebc3
100644
(file)
--- a/
build/rpmfc.c
+++ b/
build/rpmfc.c
@@
-320,6
+320,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;
@@
-329,10
+330,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;
}
}