about summary refs log tree commit diff
path: root/nis/nss_nis/nis-proto.c
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nss_nis/nis-proto.c')
-rw-r--r--nis/nss_nis/nis-proto.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c
index a6f57fde98..3af0f4e896 100644
--- a/nis/nss_nis/nis-proto.c
+++ b/nis/nss_nis/nis-proto.c
@@ -192,7 +192,7 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
 
   if (name == NULL)
     {
-      __set_errno (EINVAL);
+      *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
     }
 
@@ -223,13 +223,14 @@ _nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
   free (result);
 
   parse_res = _nss_files_parse_protoent (p, proto, data, buflen, errnop);
-  if (parse_res == -1)
-    return NSS_STATUS_TRYAGAIN;
-
-  if (parse_res)
-    return NSS_STATUS_SUCCESS;
-  else
-    return NSS_STATUS_NOTFOUND;
+  if (parse_res < 1)
+    {
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+      else
+	return NSS_STATUS_NOTFOUND;
+    }
+  return NSS_STATUS_SUCCESS;
 }
 
 enum nss_status
@@ -271,11 +272,12 @@ _nss_nis_getprotobynumber_r (int number, struct protoent *proto,
   free (result);
 
   parse_res = _nss_files_parse_protoent (p, proto, data, buflen, errnop);
-  if (parse_res == -1)
-    return NSS_STATUS_TRYAGAIN;
-
-  if (parse_res)
-    return NSS_STATUS_SUCCESS;
-  else
-    return NSS_STATUS_NOTFOUND;
+  if (parse_res < 1)
+    {
+      if (parse_res == -1)
+	return NSS_STATUS_TRYAGAIN;
+      else
+	return NSS_STATUS_NOTFOUND;
+    }
+  return NSS_STATUS_SUCCESS;
 }