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

Diff for /src/usr.bin/ssh/sftp.c between version 1.35 and 1.36

version 1.35, 2003/05/15 03:44:00 version 1.36, 2003/06/04 12:41:22
Line 40 
Line 40 
 FILE* infile;  FILE* infile;
 size_t copy_buffer_len = 32768;  size_t copy_buffer_len = 32768;
 size_t num_requests = 16;  size_t num_requests = 16;
   static pid_t sshpid = -1;
   
 extern int showprogress;  extern int showprogress;
   
 static void  static void
 connect_to_server(char *path, char **args, int *in, int *out, pid_t *sshpid)  killchild(int signo)
 {  {
           if (sshpid > 1)
                   kill(sshpid, signo);
   
           _exit(1);
   }
   
   static void
   connect_to_server(char *path, char **args, int *in, int *out)
   {
         int c_in, c_out;          int c_in, c_out;
   
 #ifdef USE_PIPES  #ifdef USE_PIPES
Line 66 
Line 76 
         c_in = c_out = inout[1];          c_in = c_out = inout[1];
 #endif /* USE_PIPES */  #endif /* USE_PIPES */
   
         if ((*sshpid = fork()) == -1)          if ((sshpid = fork()) == -1)
                 fatal("fork: %s", strerror(errno));                  fatal("fork: %s", strerror(errno));
         else if (*sshpid == 0) {          else if (sshpid == 0) {
                 if ((dup2(c_in, STDIN_FILENO) == -1) ||                  if ((dup2(c_in, STDIN_FILENO) == -1) ||
                     (dup2(c_out, STDOUT_FILENO) == -1)) {                      (dup2(c_out, STDOUT_FILENO) == -1)) {
                         fprintf(stderr, "dup2: %s\n", strerror(errno));                          fprintf(stderr, "dup2: %s\n", strerror(errno));
Line 83 
Line 93 
                 exit(1);                  exit(1);
         }          }
   
           signal(SIGTERM, killchild);
           signal(SIGINT, killchild);
           signal(SIGHUP, killchild);
         close(c_in);          close(c_in);
         close(c_out);          close(c_out);
 }  }
Line 103 
Line 116 
 main(int argc, char **argv)  main(int argc, char **argv)
 {  {
         int in, out, ch, err;          int in, out, ch, err;
         pid_t sshpid;  
         char *host, *userhost, *cp, *file2;          char *host, *userhost, *cp, *file2;
         int debug_level = 0, sshver = 2;          int debug_level = 0, sshver = 2;
         char *file1 = NULL, *sftp_server = NULL;          char *file1 = NULL, *sftp_server = NULL;
Line 220 
Line 232 
                 args.list[0] = ssh_program;                  args.list[0] = ssh_program;
   
                 fprintf(stderr, "Connecting to %s...\n", host);                  fprintf(stderr, "Connecting to %s...\n", host);
                 connect_to_server(ssh_program, args.list, &in, &out,                  connect_to_server(ssh_program, args.list, &in, &out);
                     &sshpid);  
         } else {          } else {
                 args.list = NULL;                  args.list = NULL;
                 addargs(&args, "sftp-server");                  addargs(&args, "sftp-server");
   
                 fprintf(stderr, "Attaching to %s...\n", sftp_direct);                  fprintf(stderr, "Attaching to %s...\n", sftp_direct);
                 connect_to_server(sftp_direct, args.list, &in, &out,                  connect_to_server(sftp_direct, args.list, &in, &out);
                     &sshpid);  
         }          }
   
         err = interactive_loop(in, out, file1, file2);          err = interactive_loop(in, out, file1, file2);

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