/[cvs]/ccvs/src/run.c
ViewVC logotype

Diff of /ccvs/src/run.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.59 by dprice, Thu Sep 29 20:20:34 2005 UTC revision 1.60 by dprice, Mon Oct 3 19:35:50 2005 UTC
# Line 561  piped_child (char *const *command, int * Line 561  piped_child (char *const *command, int *
561          error (1, errno, "cannot fork");          error (1, errno, "cannot fork");
562      if (pid == 0)      if (pid == 0)
563      {      {
564          if (dup2 (to_child_pipe[0], STDIN_FILENO) < 0)          /* The child.  */
565              error (1, errno, "cannot dup2 pipe");  
566            /* The parent uses these ends of the pipes.  */
567          if (close (to_child_pipe[1]) < 0)          if (close (to_child_pipe[1]) < 0)
568              error (1, errno, "cannot close pipe");              error (1, errno, "cannot close pipe");
569          if (close (from_child_pipe[0]) < 0)          if (close (from_child_pipe[0]) < 0)
570              error (1, errno, "cannot close pipe");              error (1, errno, "cannot close pipe");
571    
572            /* Fool an unwitting child into reading from and writing to
573             * the pipes.
574             */
575            if (dup2 (to_child_pipe[0], STDIN_FILENO) < 0)
576                error (1, errno, "cannot dup2 pipe");
577          if (dup2 (from_child_pipe[1], STDOUT_FILENO) < 0)          if (dup2 (from_child_pipe[1], STDOUT_FILENO) < 0)
578              error (1, errno, "cannot dup2 pipe");              error (1, errno, "cannot dup2 pipe");
579    
580            /* Don't need these fds after the dup2.  */
581            if (close (to_child_pipe[0]) < 0)
582                error (1, errno, "cannot close pipe");
583            if (close (from_child_pipe[1]) < 0)
584                error (1, errno, "cannot close pipe");
585    
586          if (fix_stderr)          if (fix_stderr)
587              work_around_openssh_glitch ();              work_around_openssh_glitch ();
588    
# Line 577  piped_child (char *const *command, int * Line 590  piped_child (char *const *command, int *
590          execvp ((char *)command[0], (char **)command);          execvp ((char *)command[0], (char **)command);
591          error (1, errno, "cannot exec %s", command[0]);          error (1, errno, "cannot exec %s", command[0]);
592      }      }
593    
594        /* The parent.  */
595      if (close (to_child_pipe[0]) < 0)      if (close (to_child_pipe[0]) < 0)
596          error (1, errno, "cannot close pipe");          error (1, errno, "cannot close pipe");
597      if (close (from_child_pipe[1]) < 0)      if (close (from_child_pipe[1]) < 0)

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.60

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26