|
|
|
@ -178,6 +178,8 @@ updateblock(Block *block, int sigval)
|
|
|
|
|
switch (fork()) {
|
|
|
|
|
case -1:
|
|
|
|
|
perror("updateblock - fork");
|
|
|
|
|
close(fd[0]);
|
|
|
|
|
close(fd[1]);
|
|
|
|
|
cleanup();
|
|
|
|
|
exit(1);
|
|
|
|
|
case 0:
|
|
|
|
@ -185,6 +187,7 @@ updateblock(Block *block, int sigval)
|
|
|
|
|
if (fd[1] != STDOUT_FILENO) {
|
|
|
|
|
if (dup2(fd[1], STDOUT_FILENO) != STDOUT_FILENO) {
|
|
|
|
|
perror("updateblock - child - dup2");
|
|
|
|
|
close(fd[1]);
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
close(fd[1]);
|
|
|
|
@ -213,6 +216,7 @@ updateblock(Block *block, int sigval)
|
|
|
|
|
while (rd > 0 && (trd += rd) < CMDOUTLENGTH);
|
|
|
|
|
if (rd == -1) {
|
|
|
|
|
perror("updateblock - read");
|
|
|
|
|
close(fd[0]);
|
|
|
|
|
cleanup();
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
@ -281,14 +285,17 @@ writepid()
|
|
|
|
|
exit(2);
|
|
|
|
|
}
|
|
|
|
|
perror("writepid - fcntl");
|
|
|
|
|
close(fd);
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
if (ftruncate(fd, 0) == -1) {
|
|
|
|
|
perror("writepid - ftruncate");
|
|
|
|
|
close(fd);
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
if (dprintf(fd, "%ld", (long)getpid()) < 0) {
|
|
|
|
|
perror("writepid - dprintf");
|
|
|
|
|
close(fd);
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|