[BACK]Return to region.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Diff for /src/usr.bin/mg/region.c between version 1.35 and 1.36

version 1.35, 2015/03/19 21:22:15 version 1.36, 2016/09/08 07:50:09
Line 12 
Line 12 
 #include <sys/queue.h>  #include <sys/queue.h>
 #include <sys/socket.h>  #include <sys/socket.h>
 #include <sys/types.h>  #include <sys/types.h>
   #include <sys/wait.h>
 #include <errno.h>  #include <errno.h>
 #include <fcntl.h>  #include <fcntl.h>
 #include <poll.h>  #include <poll.h>
Line 515 
Line 516 
 pipeio(const char* const path, char* const argv[], char* const text, int len,  pipeio(const char* const path, char* const argv[], char* const text, int len,
     struct buffer *outbp)      struct buffer *outbp)
 {  {
         int s[2];          int s[2], ret;
         char *err;          char *err;
           pid_t pid;
   
         if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, s) == -1) {          if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, s) == -1) {
                 dobeep();                  dobeep();
Line 524 
Line 526 
                 return (FALSE);                  return (FALSE);
         }          }
   
         switch(fork()) {          switch((pid = fork())) {
         case -1:          case -1:
                 dobeep();                  dobeep();
                 ewprintf("Can't fork");                  ewprintf("Can't fork");
Line 548 
Line 550 
         default:          default:
                 /* Parent process */                  /* Parent process */
                 close(s[1]);                  close(s[1]);
                 return (iomux(s[0], text, len, outbp));                  ret = iomux(s[0], text, len, outbp);
                   waitpid(pid, NULL, 0); /* Collect child to prevent zombies */
   
                   return (ret);
         }          }
         return (FALSE);          return (FALSE);
 }  }

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36