eliminate redundant close in provide/require processing.
CVS patchset: 2286 CVS date: 1998/09/10 15:09:21
This commit is contained in:
parent
1ae7d58bf0
commit
173ebb3fe6
1
CHANGES
1
CHANGES
|
@ -16,6 +16,7 @@
|
|||
- create /usr/lib/rpm directory and move rpmrc et al there
|
||||
|
||||
2.5.3 -> 2.5.4:
|
||||
- eliminate redundant close in provide/require processing.
|
||||
- solaris portability patch resurrection (Steve Sanberg).
|
||||
- add %license/%readme virtual file attributes
|
||||
- align "Build Host:" with other fields
|
||||
|
|
|
@ -1431,7 +1431,6 @@ static StringBuf getOutputFrom(char *dir, char *argv[],
|
|||
int failNonZero)
|
||||
{
|
||||
int progPID;
|
||||
int progDead;
|
||||
int toProg[2];
|
||||
int fromProg[2];
|
||||
int status;
|
||||
|
@ -1478,12 +1477,7 @@ static StringBuf getOutputFrom(char *dir, char *argv[],
|
|||
|
||||
readBuff = newStringBuf();
|
||||
|
||||
progDead = 0;
|
||||
do {
|
||||
if (waitpid(progPID, &status, WNOHANG)) {
|
||||
progDead = 1;
|
||||
}
|
||||
|
||||
/* Write some stuff to the process if possible */
|
||||
if (writeBytesLeft) {
|
||||
if ((bytesWritten =
|
||||
|
@ -1497,22 +1491,22 @@ static StringBuf getOutputFrom(char *dir, char *argv[],
|
|||
}
|
||||
writeBytesLeft -= bytesWritten;
|
||||
writePtr += bytesWritten;
|
||||
} else {
|
||||
} else if (toProg[1] >= 0) {
|
||||
close(toProg[1]);
|
||||
toProg[1] = -1;
|
||||
}
|
||||
|
||||
/* Read any data from prog */
|
||||
bytes = read(fromProg[0], buf, sizeof(buf)-1);
|
||||
while (bytes > 0) {
|
||||
while ((bytes = read(fromProg[0], buf, sizeof(buf)-1)) > 0) {
|
||||
buf[bytes] = '\0';
|
||||
appendStringBuf(readBuff, buf);
|
||||
bytes = read(fromProg[0], buf, sizeof(buf)-1);
|
||||
}
|
||||
|
||||
/* terminate when prog dies */
|
||||
} while (!progDead);
|
||||
} while (!waitpid(progPID, &status, WNOHANG));
|
||||
|
||||
close(toProg[1]);
|
||||
if (toProg[1] >= 0)
|
||||
close(toProg[1]);
|
||||
close(fromProg[0]);
|
||||
signal(SIGPIPE, oldhandler);
|
||||
|
||||
|
|
Loading…
Reference in New Issue