diff options
Diffstat (limited to 'crypto/openssh/sftp.c')
-rw-r--r-- | crypto/openssh/sftp.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/crypto/openssh/sftp.c b/crypto/openssh/sftp.c index 0a7689c..ddc7530 100644 --- a/crypto/openssh/sftp.c +++ b/crypto/openssh/sftp.c @@ -24,7 +24,7 @@ #include "includes.h" -RCSID("$OpenBSD: sftp.c,v 1.26 2002/02/12 12:32:27 djm Exp $"); +RCSID("$OpenBSD: sftp.c,v 1.29 2002/04/02 17:37:48 markus Exp $"); /* XXX: short-form remote directory listings (like 'ls -C') */ @@ -88,7 +88,7 @@ static void usage(void) { extern char *__progname; - + fprintf(stderr, "usage: %s [-vC1] [-b batchfile] [-o option] [-s subsystem|path] [-B buffer_size]\n" " [-F config] [-P direct server path] [-S program]\n" @@ -165,7 +165,7 @@ main(int argc, char **argv) case 'R': num_requests = strtol(optarg, &cp, 10); if (num_requests == 0 || *cp != '\0') - fatal("Invalid number of requests \"%s\"", + fatal("Invalid number of requests \"%s\"", optarg); break; case 'h': @@ -174,6 +174,8 @@ main(int argc, char **argv) } } + log_init(argv[0], ll, SYSLOG_FACILITY_USER, 1); + if (sftp_direct == NULL) { if (optind == argc || argc > (optind + 2)) usage(); @@ -203,7 +205,6 @@ main(int argc, char **argv) usage(); } - log_init(argv[0], ll, SYSLOG_FACILITY_USER, 1); addargs(&args, "-oProtocol %d", sshver); /* no subsystem if the server-spec contains a '/' */ @@ -211,19 +212,19 @@ main(int argc, char **argv) addargs(&args, "-s"); addargs(&args, "%s", host); - addargs(&args, "%s", (sftp_server != NULL ? + addargs(&args, "%s", (sftp_server != NULL ? sftp_server : "sftp")); args.list[0] = ssh_program; 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 { args.list = NULL; addargs(&args, "sftp-server"); 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); } @@ -234,8 +235,10 @@ main(int argc, char **argv) if (infile != stdin) fclose(infile); - if (waitpid(sshpid, NULL, 0) == -1) - fatal("Couldn't wait for ssh process: %s", strerror(errno)); + while (waitpid(sshpid, NULL, 0) == -1) + if (errno != EINTR) + fatal("Couldn't wait for ssh process: %s", + strerror(errno)); exit(0); } |