about summary refs log tree commit diff
path: root/posix/tst-gnuglob.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/tst-gnuglob.c')
-rw-r--r--posix/tst-gnuglob.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/posix/tst-gnuglob.c b/posix/tst-gnuglob.c
index b15dad12ef..72f3fa4a3e 100644
--- a/posix/tst-gnuglob.c
+++ b/posix/tst-gnuglob.c
@@ -30,7 +30,7 @@
 #include <sys/stat.h>
 
 
-/* #define DEBUG */
+// #define DEBUG
 #ifdef DEBUG
 # define PRINTF(fmt, args...) printf (fmt, ##args)
 #else
@@ -106,6 +106,9 @@ find_file (const char *s)
   if (strcmp (s, ".") == 0)
     return 0;
 
+  if (s[0] == '.' && s[1] == '/')
+    s += 2;
+
   while (*s != '\0')
     {
       char *endp = strchrnul (s, '/');
@@ -126,6 +129,10 @@ find_file (const char *s)
 	  errno = ENOENT;
 	  return -1;
 	}
+
+      if (*endp == '\0')
+	return idx + 1;
+
       if (filesystem[idx].type != DT_DIR
 	  && (idx + 1 >= nfiles
 	      || filesystem[idx].level >= filesystem[idx + 1].level))
@@ -136,9 +143,6 @@ find_file (const char *s)
 
       ++idx;
 
-      if (*endp == '\0')
-	return idx;
-
       s = endp + 1;
       ++level;
     }