summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authordds <dds@FreeBSD.org>2005-07-21 16:12:35 +0000
committerdds <dds@FreeBSD.org>2005-07-21 16:12:35 +0000
commit149187706d0ae27fab4ddabfa696ed1fe7d4d771 (patch)
treeb57fa9338f460a5ce8f050db53948cfae8061d59 /sbin
parent0e0f1d53febb118979655aa6a80faaa22472f72e (diff)
downloadFreeBSD-src-149187706d0ae27fab4ddabfa696ed1fe7d4d771.zip
FreeBSD-src-149187706d0ae27fab4ddabfa696ed1fe7d4d771.tar.gz
Interpret correctly the glob(3) return value.
Previously, interactive commands specifying a non-existent file or directory used to display an "out of memory error". MFC after: 2 weeks
Diffstat (limited to 'sbin')
-rw-r--r--sbin/restore/interactive.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sbin/restore/interactive.c b/sbin/restore/interactive.c
index d3ab5cd..e3391d0 100644
--- a/sbin/restore/interactive.c
+++ b/sbin/restore/interactive.c
@@ -365,8 +365,14 @@ getnext:
snprintf(output, sizeof(output), "%s/%s", curdir, rawname);
canon(output, name, size);
}
- if (glob(name, GLOB_ALTDIRFUNC, NULL, &ap->glob) < 0)
+ switch (glob(name, GLOB_ALTDIRFUNC, NULL, &ap->glob)) {
+ case GLOB_NOSPACE:
fprintf(stderr, "%s: out of memory\n", ap->cmd);
+ break;
+ case GLOB_NOMATCH:
+ fprintf(stderr, "%s %s: no such file or directory\n", ap->cmd, name);
+ break;
+ }
if (ap->glob.gl_pathc == 0)
return;
ap->freeglob = 1;
OpenPOWER on IntegriCloud