added real fix for 2.1 kernel write() behavior
authorewt <devnull@localhost>
Thu, 31 Oct 1996 19:45:35 +0000 (19:45 +0000)
committerewt <devnull@localhost>
Thu, 31 Oct 1996 19:45:35 +0000 (19:45 +0000)
CVS patchset: 1135
CVS date: 1996/10/31 19:45:35

lib/install.c

index 59964c6..b7ea9d9 100644 (file)
@@ -669,9 +669,10 @@ static int installArchive(char * prefix, int fd, struct fileToInstall * files,
             cpioFailed = 1;
             childDead = 1;
             kill(SIGTERM, child);
-       }
-
-       if (bytesRead && write(p[1], buf, bytesRead) != bytesRead) {
+       } else if (bytesRead == 0) {
+            /* if it's not dead yet, it will be when we close the pipe */
+            childDead = 1;
+       } else if (bytesRead && write(p[1], buf, bytesRead) != bytesRead) {
             cpioFailed = 1;
             childDead = 1;
             kill(SIGTERM, child);