diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | sftp.c | 24 |
2 files changed, 20 insertions, 8 deletions
@@ -4,6 +4,10 @@ | |||
4 | [ssh_config.5] | 4 | [ssh_config.5] |
5 | mention that ProxyCommand is executed using shell "exec" to avoid | 5 | mention that ProxyCommand is executed using shell "exec" to avoid |
6 | a lingering process; bz#1977 | 6 | a lingering process; bz#1977 |
7 | - djm@cvs.openbsd.org 2014/07/09 01:45:10 | ||
8 | [sftp.c] | ||
9 | more useful error message when GLOB_NOSPACE occurs; | ||
10 | bz#2254, patch from Orion Poplawski | ||
7 | 11 | ||
8 | 20140706 | 12 | 20140706 |
9 | - OpenBSD CVS Sync | 13 | - OpenBSD CVS Sync |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp.c,v 1.163 2014/05/05 07:02:30 logan Exp $ */ | 1 | /* $OpenBSD: sftp.c,v 1.164 2014/07/09 01:45:10 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> | 3 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> |
4 | * | 4 | * |
@@ -589,15 +589,19 @@ process_get(struct sftp_conn *conn, char *src, char *dst, char *pwd, | |||
589 | char *abs_dst = NULL; | 589 | char *abs_dst = NULL; |
590 | glob_t g; | 590 | glob_t g; |
591 | char *filename, *tmp=NULL; | 591 | char *filename, *tmp=NULL; |
592 | int i, err = 0; | 592 | int i, r, err = 0; |
593 | 593 | ||
594 | abs_src = xstrdup(src); | 594 | abs_src = xstrdup(src); |
595 | abs_src = make_absolute(abs_src, pwd); | 595 | abs_src = make_absolute(abs_src, pwd); |
596 | memset(&g, 0, sizeof(g)); | 596 | memset(&g, 0, sizeof(g)); |
597 | 597 | ||
598 | debug3("Looking up %s", abs_src); | 598 | debug3("Looking up %s", abs_src); |
599 | if (remote_glob(conn, abs_src, GLOB_MARK, NULL, &g)) { | 599 | if ((r = remote_glob(conn, abs_src, GLOB_MARK, NULL, &g)) != 0) { |
600 | error("File \"%s\" not found.", abs_src); | 600 | if (r == GLOB_NOSPACE) { |
601 | error("Too many matches for \"%s\".", abs_src); | ||
602 | } else { | ||
603 | error("File \"%s\" not found.", abs_src); | ||
604 | } | ||
601 | err = -1; | 605 | err = -1; |
602 | goto out; | 606 | goto out; |
603 | } | 607 | } |
@@ -862,19 +866,23 @@ do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path, | |||
862 | { | 866 | { |
863 | char *fname, *lname; | 867 | char *fname, *lname; |
864 | glob_t g; | 868 | glob_t g; |
865 | int err; | 869 | int err, r; |
866 | struct winsize ws; | 870 | struct winsize ws; |
867 | u_int i, c = 1, colspace = 0, columns = 1, m = 0, width = 80; | 871 | u_int i, c = 1, colspace = 0, columns = 1, m = 0, width = 80; |
868 | 872 | ||
869 | memset(&g, 0, sizeof(g)); | 873 | memset(&g, 0, sizeof(g)); |
870 | 874 | ||
871 | if (remote_glob(conn, path, | 875 | if ((r = remote_glob(conn, path, |
872 | GLOB_MARK|GLOB_NOCHECK|GLOB_BRACE|GLOB_KEEPSTAT|GLOB_NOSORT, | 876 | GLOB_MARK|GLOB_NOCHECK|GLOB_BRACE|GLOB_KEEPSTAT|GLOB_NOSORT, |
873 | NULL, &g) || | 877 | NULL, &g)) != 0 || |
874 | (g.gl_pathc && !g.gl_matchc)) { | 878 | (g.gl_pathc && !g.gl_matchc)) { |
875 | if (g.gl_pathc) | 879 | if (g.gl_pathc) |
876 | globfree(&g); | 880 | globfree(&g); |
877 | error("Can't ls: \"%s\" not found", path); | 881 | if (r == GLOB_NOSPACE) { |
882 | error("Can't ls: Too many matches for \"%s\"", path); | ||
883 | } else { | ||
884 | error("Can't ls: \"%s\" not found", path); | ||
885 | } | ||
878 | return -1; | 886 | return -1; |
879 | } | 887 | } |
880 | 888 | ||