32 lines
917 B
Diff
32 lines
917 B
Diff
Fix uncompress waitpid logic to shut up the compiler [#160434]
|
|
|
|
--- ./file/src/compress.c.orig 2006-03-24 15:37:23.000000000 +0000
|
|
+++ ./file/src/compress.c 2006-03-24 15:42:52.000000000 +0000
|
|
@@ -341,6 +341,7 @@ uncompressbuf(struct magic_set *ms, int
|
|
file_error(ms, errno, "cannot create pipe");
|
|
return 0;
|
|
}
|
|
+ pid2 = (pid_t)-1;
|
|
switch ((pid1=fork())) {
|
|
case 0: /* child */
|
|
(void) close(0);
|
|
@@ -382,7 +383,7 @@ uncompressbuf(struct magic_set *ms, int
|
|
* fork again, to avoid blocking because both
|
|
* pipes filled
|
|
*/
|
|
- switch (fork()) {
|
|
+ switch ((pid2 = fork())) {
|
|
case 0: /* child */
|
|
(void)close(fdout[0]);
|
|
if (swrite(fdin[1], old, n) != n) {
|
|
@@ -439,7 +440,8 @@ err:
|
|
(void) close(fdin[1]);
|
|
(void) close(fdout[0]);
|
|
waitpid(pid1, NULL, 0);
|
|
- waitpid(pid2, NULL, 0);
|
|
+ if (pid2 != (pid_t)-1)
|
|
+ waitpid(pid2, NULL, 0);
|
|
return n;
|
|
}
|
|
/*@notreached@*/
|