diff options
author | Paul Nasrat <pnasrat@redhat.com> | 2007-04-16 13:07:52 +0100 |
---|---|---|
committer | Paul Nasrat <pnasrat@redhat.com> | 2007-04-16 13:07:52 +0100 |
commit | 026b82f53b8f19e2b3af1f4366de0de2554d2173 (patch) | |
tree | 5d9008ef96d23859ff26577d2f0cfd9cd48ad69d /file/src | |
parent | cc4d429e932cfc46fd75f09378858c4ba0fb8ab9 (diff) | |
download | librpm-tizen-026b82f53b8f19e2b3af1f4366de0de2554d2173.tar.gz librpm-tizen-026b82f53b8f19e2b3af1f4366de0de2554d2173.tar.bz2 librpm-tizen-026b82f53b8f19e2b3af1f4366de0de2554d2173.zip |
Fix uncompress waitpid logic to shut up the compiler [#160434]
Patch from OpenSuSE
Diffstat (limited to 'file/src')
-rw-r--r-- | file/src/compress.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/file/src/compress.c b/file/src/compress.c index 18af9a790..af69f3c50 100644 --- a/file/src/compress.c +++ b/file/src/compress.c @@ -341,6 +341,7 @@ uncompressbuf(struct magic_set *ms, int fd, size_t method, 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 fd, size_t method, * 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@*/ |