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

Diff for /src/usr.bin/tmux/tmux.c between version 1.100 and 1.101

version 1.100, 2011/01/03 23:35:21 version 1.101, 2011/01/08 01:52:37
Line 194 
Line 194 
         return (path);          return (path);
 }  }
   
   void
   setblocking(int fd, int state)
   {
           int mode;
   
           if ((mode = fcntl(fd, F_GETFL)) != -1) {
                   if (!state)
                           mode |= O_NONBLOCK;
                   else
                           mode &= ~O_NONBLOCK;
                   fcntl(fd, F_SETFL, mode);
           }
   }
   
 __dead void  __dead void
 shell_exec(const char *shell, const char *shellcmd)  shell_exec(const char *shell, const char *shellcmd)
 {  {
         const char      *shellname, *ptr;          const char      *shellname, *ptr;
         char            *argv0;          char            *argv0;
         int              mode;  
   
         ptr = strrchr(shell, '/');          ptr = strrchr(shell, '/');
         if (ptr != NULL && *(ptr + 1) != '\0')          if (ptr != NULL && *(ptr + 1) != '\0')
Line 212 
Line 225 
                 xasprintf(&argv0, "%s", shellname);                  xasprintf(&argv0, "%s", shellname);
         setenv("SHELL", shell, 1);          setenv("SHELL", shell, 1);
   
         if ((mode = fcntl(STDIN_FILENO, F_GETFL)) != -1)          setblocking(STDIN_FILENO, 1);
                 fcntl(STDIN_FILENO, F_SETFL, mode & ~O_NONBLOCK);          setblocking(STDOUT_FILENO, 1);
         if ((mode = fcntl(STDOUT_FILENO, F_GETFL)) != -1)          setblocking(STDERR_FILENO, 1);
                 fcntl(STDOUT_FILENO, F_SETFL, mode & ~O_NONBLOCK);  
         if ((mode = fcntl(STDERR_FILENO, F_GETFL)) != -1)  
                 fcntl(STDERR_FILENO, F_SETFL, mode & ~O_NONBLOCK);  
         closefrom(STDERR_FILENO + 1);          closefrom(STDERR_FILENO + 1);
   
         execl(shell, argv0, "-c", shellcmd, (char *) NULL);          execl(shell, argv0, "-c", shellcmd, (char *) NULL);

Legend:
Removed from v.1.100  
changed lines
  Added in v.1.101