summary refs log tree commit diff
path: root/posix/fnmatch.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/fnmatch.c')
-rw-r--r--posix/fnmatch.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/posix/fnmatch.c b/posix/fnmatch.c
index eb3f1cc2d4..9617d336f4 100644
--- a/posix/fnmatch.c
+++ b/posix/fnmatch.c
@@ -211,8 +211,7 @@ internal_fnmatch (const char *pattern, const char *string,
 	    {
 	      const char *endp;
 
-	      if (!(flags & FNM_FILE_NAME) || (endp = strchr (n, '/')) == NULL)
-		endp = strchr (n, '\0');
+	      endp = __strchrnul (n, (flags & FNM_FILE_NAME) ? '/' : '\0');
 
 	      if (c == '[')
 		{