about summary refs log tree commit diff
path: root/nss/nss_files/files-initgroups.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-initgroups.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-initgroups.c')
-rw-r--r--nss/nss_files/files-initgroups.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/nss/nss_files/files-initgroups.c b/nss/nss_files/files-initgroups.c
index 577d6ddf1e..b6f505984a 100644
--- a/nss/nss_files/files-initgroups.c
+++ b/nss/nss_files/files-initgroups.c
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 #include <scratch_buffer.h>
 #include <nss.h>
+#include <nss_files.h>
 
 NSS_DECLARE_MODULE_FUNCTIONS (files)
 
@@ -34,16 +35,13 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
 			   long int *size, gid_t **groupsp, long int limit,
 			   int *errnop)
 {
-  FILE *stream = fopen ("/etc/group", "rce");
+  FILE *stream = __nss_files_fopen ("/etc/group");
   if (stream == NULL)
     {
       *errnop = errno;
       return *errnop == ENOMEM ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
     }
 
-  /* No other thread using this stream.  */
-  __fsetlocking (stream, FSETLOCKING_BYCALLER);
-
   char *line = NULL;
   size_t linelen = 0;
   enum nss_status status = NSS_STATUS_SUCCESS;