* parallel: New program, contributed by Tollef Fog Heen,
that can run multiple jobs in parallel, optionally checking
load average.
+ * mispipe: Fix closing of extra pipe FD before starting command
+ so it is not inherited by daemons. Closes: #533448
+ (Thanks, Jeremie Koenig)
-- Joey Hess <joeyh@debian.org> Thu, 02 Jul 2009 14:57:12 -0400
/* Make the reading end of the pipe the new standard input. */
if (dup2(filedes[0], 0) == -1)
error_with_errno("Failed (in child) redefining standard input");
+ /* Close the original file descriptor for it */
+ if (close(filedes[0]))
+ error_with_errno("Failed (in child) closing filedes[0]");
/* Close the other end of the pipe. */
if (close(filedes[1]))
error_with_errno("Failed (in child) closing filedes[1]");
/* Do the second command, and throw away the exit status. */
system(cmd);
- /* Close all the file descriptors. */
- if (close(filedes[0]))
- error_with_errno("Failed (in child) closing filedes[0]"
- " (while cleaning up)");
+ /* Close the standard input. */
if (close(0))
error_with_errno("Failed (in child) closing standard output "
" (while cleaning up)");
/* Make the writing end of the pipe the new standard output. */
if (dup2(filedes[1], 1) == -1)
error_with_errno("Failed redefining standard output");
+ /* Close the original file descriptor for it. */
+ if (close(filedes[1]))
+ error_with_errno("Failed closing filedes[1]");
/* Close the other end of the pipe. */
if (close(filedes[0]))
error_with_errno("Failed closing filedes[0]");
/* Do the first command, and (crucially) get the status. */
status_big = system(argv[1]);
- /* Close the pipe "standard output". */
- if (close(filedes[1]))
- error_with_errno("Failed closing filedes[1] (while cleaning up)");
/* Close standard output. */
if (close(1))
error_with_errno("Failed closing standard output (while cleaning up)");