]> andersk Git - openssh.git/blobdiff - sftp.c
- djm@cvs.openbsd.org 2010/01/30 02:54:53
[openssh.git] / sftp.c
diff --git a/sftp.c b/sftp.c
index 16f84987c5d3cb35db84a3df1fba65908dfbc519..d65d4ec62ea74ce39a3804d5a78dfa2bdf4e9e74 100644 (file)
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.119 2010/01/13 01:40:16 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.123 2010/01/27 19:21:39 djm Exp $ */
 /*
  * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
  *
@@ -233,18 +233,18 @@ help(void)
            "df [-hi] [path]                    Display statistics for current directory or\n"
            "                                   filesystem containing 'path'\n"
            "exit                               Quit sftp\n"
-           "get [-Pr] remote-path [local-path] Download file\n"
+           "get [-Ppr] remote [local]          Download file\n"
            "help                               Display this help text\n"
            "lcd path                           Change local directory to 'path'\n"
            "lls [ls-options [path]]            Display local directory listing\n"
            "lmkdir path                        Create local directory\n"
            "ln oldpath newpath                 Symlink remote file\n"
            "lpwd                               Print local working directory\n"
-           "ls [-1aflnrSt] [path]              Display remote directory listing\n"
+           "ls [-1afhlnrSt] [path]             Display remote directory listing\n"
            "lumask umask                       Set local umask to 'umask'\n"
            "mkdir path                         Create remote directory\n"
            "progress                           Toggle display of progress meter\n"
-           "put [-Pr] local-path [remote-path] Upload file\n"
+           "put [-Ppr] local [remote]          Upload file\n"
            "pwd                                Display remote working directory\n"
            "quit                               Quit sftp\n"
            "rename oldpath newpath             Rename remote file\n"
@@ -1760,15 +1760,12 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
        }
 
        lf = el_line(el);
-       /*
-        * XXX should we really extend here? the user may not be done if
-        * the filename is a directory.
-        */
        if (g.gl_matchc == 1) {
                i = 0;
                if (!terminated)
                        ins[i++] = quote;
-               if (lastarg || *(lf->cursor) != ' ')
+               if (*(lf->cursor - 1) != '/' &&
+                   (lastarg || *(lf->cursor) != ' '))
                        ins[i++] = ' ';
                ins[i] = '\0';
                if (i > 0 && el_insertstr(el, ins) == -1)
@@ -2030,9 +2027,11 @@ connect_to_server(char *path, char **args, int *in, int *out)
                 * The underlying ssh is in the same process group, so we must
                 * ignore SIGINT if we want to gracefully abort commands,
                 * otherwise the signal will make it to the ssh process and
-                * kill it too
+                * kill it too.  Contrawise, since sftp sends SIGTERMs to the
+                * underlying ssh, it must *not* ignore that signal.
                 */
                signal(SIGINT, SIG_IGN);
+               signal(SIGTERM, SIG_DFL);
                execvp(path, args);
                fprintf(stderr, "exec: %s: %s\n", path, strerror(errno));
                _exit(1);
@@ -2096,7 +2095,7 @@ main(int argc, char **argv)
        infile = stdin;
 
        while ((ch = getopt(argc, argv,
-           "1246hqrvCc:D:i:o:s:S:b:B:F:P:R:")) != -1) {
+           "1246hpqrvCc:D:i:o:s:S:b:B:F:P:R:")) != -1) {
                switch (ch) {
                /* Passed through to ssh(1) */
                case '4':
This page took 0.034924 seconds and 4 git commands to generate.