summary refs log tree commit diff
path: root/nss/nss_files/files-netgrp.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-07-16 16:12:46 +0200
committerFlorian Weimer <fweimer@redhat.com>2020-07-21 07:32:46 +0200
commit299210c1fa67e2dfb564475986fce11cd33db9ad (patch)
tree7230de5a2b2d0556428f53f28d2d5f2ccfad12d8 /nss/nss_files/files-netgrp.c
parent469c03907b116c37c98d8ad7a9edac2bdbf3e934 (diff)
downloadglibc-299210c1fa67e2dfb564475986fce11cd33db9ad.tar.gz
glibc-299210c1fa67e2dfb564475986fce11cd33db9ad.tar.xz
glibc-299210c1fa67e2dfb564475986fce11cd33db9ad.zip
nss_files: Consolidate file opening in __nss_files_fopen
Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'nss/nss_files/files-netgrp.c')
-rw-r--r--nss/nss_files/files-netgrp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/nss/nss_files/files-netgrp.c b/nss/nss_files/files-netgrp.c
index 2c580af01d..66e16b7c77 100644
--- a/nss/nss_files/files-netgrp.c
+++ b/nss/nss_files/files-netgrp.c
@@ -26,6 +26,7 @@
 #include <string.h>
 #include "nsswitch.h"
 #include "netgroup.h"
+#include <nss_files.h>
 
 NSS_DECLARE_MODULE_FUNCTIONS (files)
 
@@ -64,7 +65,7 @@ _nss_files_setnetgrent (const char *group, struct __netgrent *result)
     return NSS_STATUS_UNAVAIL;
 
   /* Find the netgroups file and open it.  */
-  fp = fopen (DATAFILE, "rce");
+  fp = __nss_files_fopen (DATAFILE);
   if (fp == NULL)
     status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
   else
@@ -78,8 +79,6 @@ _nss_files_setnetgrent (const char *group, struct __netgrent *result)
       status = NSS_STATUS_NOTFOUND;
       result->cursor = result->data;
 
-      __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
       while (!feof_unlocked (fp))
 	{
 	  ssize_t curlen = getline (&line, &line_len, fp);