Bugzilla – Attachment 2454 Details for
Bug 2254
Better error message for globs that have too many results.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to detect GLOB_NOSPACE and return better error message
openssh-6.6p1-globerror.patch (text/plain), 1.51 KB, created by
Orion Poplawski
on 2014-07-09 04:33:42 AEST
(
hide
)
Description:
Patch to detect GLOB_NOSPACE and return better error message
Filename:
MIME Type:
Creator:
Orion Poplawski
Created:
2014-07-09 04:33:42 AEST
Size:
1.51 KB
patch
obsolete
>diff -up openssh-6.6p1/sftp.c.globerror openssh-6.6p1/sftp.c >--- openssh-6.6p1/sftp.c.globerror 2013-11-20 19:57:15.000000000 -0700 >+++ openssh-6.6p1/sftp.c 2014-07-08 11:34:22.872631581 -0600 >@@ -586,15 +586,19 @@ process_get(struct sftp_conn *conn, char > char *abs_dst = NULL; > glob_t g; > char *filename, *tmp=NULL; >- int i, err = 0; >+ int i, r, err = 0; > > abs_src = xstrdup(src); > abs_src = make_absolute(abs_src, pwd); > memset(&g, 0, sizeof(g)); > > debug3("Looking up %s", abs_src); >- if (remote_glob(conn, abs_src, GLOB_MARK, NULL, &g)) { >- error("File \"%s\" not found.", abs_src); >+ if ((r = remote_glob(conn, abs_src, GLOB_MARK, NULL, &g)) != 0) { >+ if (r == GLOB_NOSPACE) { >+ error("Too many matches for \"%s\".", abs_src); >+ } else { >+ error("File \"%s\" not found.", abs_src); >+ } > err = -1; > goto out; > } >@@ -855,19 +859,23 @@ do_globbed_ls(struct sftp_conn *conn, ch > { > char *fname, *lname; > glob_t g; >- int err; >+ int err, r; > struct winsize ws; > u_int i, c = 1, colspace = 0, columns = 1, m = 0, width = 80; > > memset(&g, 0, sizeof(g)); > >- if (remote_glob(conn, path, >+ if ((r = remote_glob(conn, path, > GLOB_MARK|GLOB_NOCHECK|GLOB_BRACE|GLOB_KEEPSTAT|GLOB_NOSORT, >- NULL, &g) || >+ NULL, &g)) != 0 || > (g.gl_pathc && !g.gl_matchc)) { > if (g.gl_pathc) > globfree(&g); >- error("Can't ls: \"%s\" not found", path); >+ if (r == GLOB_NOSPACE) { >+ error("Can't ls: Too many matches for \"%s\"", path); >+ } else { >+ error("Can't ls: \"%s\" not found", path); >+ } > return -1; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2254
: 2454