summaryrefslogtreecommitdiff
path: root/posix/globtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/globtest.c')
-rw-r--r--posix/globtest.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/posix/globtest.c b/posix/globtest.c
index 589e91b973..7008a8bcd1 100644
--- a/posix/globtest.c
+++ b/posix/globtest.c
@@ -18,6 +18,7 @@
#include <stdio.h>
#include <glob.h>
+#include <unistd.h>
int
main (int argc, char *argv[])
@@ -26,7 +27,11 @@ main (int argc, char *argv[])
int glob_flags = GLOB_NOSORT;
glob_t filenames;
- i = glob (argv[1], glob_flags, NULL, &filenames);
+ if (argc != 3)
+ exit (1);
+ if (chdir (argv[1]))
+ exit (1);
+ i = glob (argv[2], glob_flags, NULL, &filenames);
if (i == GLOB_NOSPACE)
puts ("GLOB_NOSPACE");