about summary refs log tree commit diff
path: root/nss/nss_files
diff options
context:
space:
mode:
Diffstat (limited to 'nss/nss_files')
-rw-r--r--nss/nss_files/files-service.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/nss/nss_files/files-service.c b/nss/nss_files/files-service.c
index 5fb38e2058..317b4fa9cc 100644
--- a/nss/nss_files/files-service.c
+++ b/nss/nss_files/files-service.c
@@ -41,8 +41,8 @@ LINE_PARSER
 
 DB_LOOKUP (servbyname, 1 + strlen (name), (".%s/%s", name, proto),
 	   {
-	     /* Must match both protocol and name.  */
-	     if (strcmp (result->s_proto, proto))
+	     /* Must match both protocol (if specified) and name.  */
+	     if (proto != NULL && strcmp (result->s_proto, proto))
 	       continue;
 	     LOOKUP_NAME (s_name, s_aliases)
 	   },