|
Lines 586-600
process_get(struct sftp_conn *conn, char
Link Here
|
| 586 |
char *abs_dst = NULL; |
586 |
char *abs_dst = NULL; |
| 587 |
glob_t g; |
587 |
glob_t g; |
| 588 |
char *filename, *tmp=NULL; |
588 |
char *filename, *tmp=NULL; |
| 589 |
int i, err = 0; |
589 |
int i, r, err = 0; |
| 590 |
|
590 |
|
| 591 |
abs_src = xstrdup(src); |
591 |
abs_src = xstrdup(src); |
| 592 |
abs_src = make_absolute(abs_src, pwd); |
592 |
abs_src = make_absolute(abs_src, pwd); |
| 593 |
memset(&g, 0, sizeof(g)); |
593 |
memset(&g, 0, sizeof(g)); |
| 594 |
|
594 |
|
| 595 |
debug3("Looking up %s", abs_src); |
595 |
debug3("Looking up %s", abs_src); |
| 596 |
if (remote_glob(conn, abs_src, GLOB_MARK, NULL, &g)) { |
596 |
if ((r = remote_glob(conn, abs_src, GLOB_MARK, NULL, &g)) != 0) { |
| 597 |
error("File \"%s\" not found.", abs_src); |
597 |
if (r == GLOB_NOSPACE) { |
|
|
598 |
error("Too many matches for \"%s\".", abs_src); |
| 599 |
} else { |
| 600 |
error("File \"%s\" not found.", abs_src); |
| 601 |
} |
| 598 |
err = -1; |
602 |
err = -1; |
| 599 |
goto out; |
603 |
goto out; |
| 600 |
} |
604 |
} |
|
Lines 855-873
do_globbed_ls(struct sftp_conn *conn, ch
Link Here
|
| 855 |
{ |
859 |
{ |
| 856 |
char *fname, *lname; |
860 |
char *fname, *lname; |
| 857 |
glob_t g; |
861 |
glob_t g; |
| 858 |
int err; |
862 |
int err, r; |
| 859 |
struct winsize ws; |
863 |
struct winsize ws; |
| 860 |
u_int i, c = 1, colspace = 0, columns = 1, m = 0, width = 80; |
864 |
u_int i, c = 1, colspace = 0, columns = 1, m = 0, width = 80; |
| 861 |
|
865 |
|
| 862 |
memset(&g, 0, sizeof(g)); |
866 |
memset(&g, 0, sizeof(g)); |
| 863 |
|
867 |
|
| 864 |
if (remote_glob(conn, path, |
868 |
if ((r = remote_glob(conn, path, |
| 865 |
GLOB_MARK|GLOB_NOCHECK|GLOB_BRACE|GLOB_KEEPSTAT|GLOB_NOSORT, |
869 |
GLOB_MARK|GLOB_NOCHECK|GLOB_BRACE|GLOB_KEEPSTAT|GLOB_NOSORT, |
| 866 |
NULL, &g) || |
870 |
NULL, &g)) != 0 || |
| 867 |
(g.gl_pathc && !g.gl_matchc)) { |
871 |
(g.gl_pathc && !g.gl_matchc)) { |
| 868 |
if (g.gl_pathc) |
872 |
if (g.gl_pathc) |
| 869 |
globfree(&g); |
873 |
globfree(&g); |
| 870 |
error("Can't ls: \"%s\" not found", path); |
874 |
if (r == GLOB_NOSPACE) { |
|
|
875 |
error("Can't ls: Too many matches for \"%s\"", path); |
| 876 |
} else { |
| 877 |
error("Can't ls: \"%s\" not found", path); |
| 878 |
} |
| 871 |
return -1; |
879 |
return -1; |
| 872 |
} |
880 |
} |
| 873 |
|
881 |
|