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

Diff for /src/usr.bin/ssh/sshconnect.c between version 1.170 and 1.171

version 1.170, 2005/10/30 08:52:18 version 1.171, 2005/12/06 22:38:27
Line 1026 
Line 1026 
   
         xfree(fp);          xfree(fp);
 }  }
   
   /*
    * Execute a local command
    */
   int
   ssh_local_cmd(const char *args)
   {
           char *shell;
           pid_t pid;
           int status;
   
           if (!options.permit_local_command ||
               args == NULL || !*args)
                   return (1);
   
           if ((shell = getenv("SHELL")) == NULL)
                   shell = _PATH_BSHELL;
   
           pid = fork();
           if (pid == 0) {
                   debug3("Executing %s -c \"%s\"", shell, args);
                   execl(shell, shell, "-c", args, (char *)NULL);
                   error("Couldn't execute %s -c \"%s\": %s",
                       shell, args, strerror(errno));
                   _exit(1);
           } else if (pid == -1)
                   fatal("fork failed: %.100s", strerror(errno));
           while (waitpid(pid, &status, 0) == -1)
                   if (errno != EINTR)
                           fatal("Couldn't wait for child: %s", strerror(errno));
   
           if (!WIFEXITED(status))
                   return (1);
   
           return (WEXITSTATUS(status));
   }

Legend:
Removed from v.1.170  
changed lines
  Added in v.1.171