From 149187706d0ae27fab4ddabfa696ed1fe7d4d771 Mon Sep 17 00:00:00 2001 From: dds Date: Thu, 21 Jul 2005 16:12:35 +0000 Subject: 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 --- sbin/restore/interactive.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sbin/restore/interactive.c') 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; -- cgit v1.1