1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

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>
This commit is contained in:
Florian Weimer
2020-07-16 16:12:46 +02:00
parent 469c03907b
commit 299210c1fa
8 changed files with 86 additions and 11 deletions

View File

@@ -29,6 +29,7 @@
#include <kernel-features.h>
#include "nsswitch.h"
#include <nss_files.h>
NSS_DECLARE_MODULE_FUNCTIONS (files)
@@ -49,7 +50,7 @@ internal_setent (FILE **stream)
if (*stream == NULL)
{
*stream = fopen ("/etc/aliases", "rce");
*stream = __nss_files_fopen ("/etc/aliases");
if (*stream == NULL)
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
@@ -215,7 +216,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result,
first_unused = cp;
listfile = fopen (&cp[9], "rce");
listfile = __nss_files_fopen (&cp[9]);
/* If the file does not exist we simply ignore
the statement. */
if (listfile != NULL