diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-07-03 07:16:22 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-07-03 07:16:22 +0300 |
commit | 74c84ef9921e7662fdd363fcad293048db17ea5f (patch) | |
tree | 8014d3ce2d201005eac4183527f217de1e960315 | |
parent | d44d2ec6829a8eeca51f9fd2f4900d82f72770e9 (diff) | |
download | librpm-tizen-74c84ef9921e7662fdd363fcad293048db17ea5f.tar.gz librpm-tizen-74c84ef9921e7662fdd363fcad293048db17ea5f.tar.bz2 librpm-tizen-74c84ef9921e7662fdd363fcad293048db17ea5f.zip |
Oops, dont hang in getOutputFrom() if we have nothing to write
-rw-r--r-- | build/rpmfc.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/build/rpmfc.c b/build/rpmfc.c index 1a1dcbd19..4fd32e3d3 100644 --- a/build/rpmfc.c +++ b/build/rpmfc.c @@ -247,6 +247,10 @@ static StringBuf getOutputFrom(const char * dir, ARGV_t argv, if (writeBytesLeft > 0) { FD_SET(toProg[1], &obits); nfd = max(nfd, toProg[1]); + } else if (toProg[1] >= 0) { + /* Close write-side pipe to notify child on EOF */ + close(toProg[1]); + toProg[1] = -1; } rc = select(nfd + 1, &ibits, &obits, NULL, NULL); @@ -273,11 +277,6 @@ static StringBuf getOutputFrom(const char * dir, ARGV_t argv, } writeBytesLeft -= nbw; writePtr += nbw; - /* Close write-side pipe to notify child on EOF */ - if (writeBytesLeft == 0) { - close(toProg[1]); - toProg[1] = -1; - } } /* Read when we get data back from the child */ |