aboutsummaryrefslogtreecommitdiff
path: root/nss/nss_files/files-key.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-08-20 15:55:44 -0400
committerUlrich Drepper <drepper@gmail.com>2011-08-20 15:55:44 -0400
commit775a77e7e43c75ce3a7960f249eb3b189889ec20 (patch)
treea7623ba338c27cf0bcb8edb46c2915c545cd453c /nss/nss_files/files-key.c
parent89f447edba330554fb50b19009938c8c19cc7414 (diff)
downloadglibc-775a77e7e43c75ce3a7960f249eb3b189889ec20.zip
glibc-775a77e7e43c75ce3a7960f249eb3b189889ec20.tar.gz
glibc-775a77e7e43c75ce3a7960f249eb3b189889ec20.tar.bz2
More optimizations of nss_files
Diffstat (limited to 'nss/nss_files/files-key.c')
-rw-r--r--nss/nss_files/files-key.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/nss/nss_files/files-key.c b/nss/nss_files/files-key.c
index 5c7ad09..fb108c8 100644
--- a/nss/nss_files/files-key.c
+++ b/nss/nss_files/files-key.c
@@ -1,5 +1,5 @@
/* Public key file parser in nss_files module.
- Copyright (C) 1996, 1997, 1998, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 2006, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -33,9 +33,7 @@ extern int xdecrypt (char *, char *);
static enum nss_status
search (const char *netname, char *result, int *errnop, int secret)
{
- FILE *stream;
-
- stream = fopen (DATAFILE, "r");
+ FILE *stream = fopen (DATAFILE, "re");
if (stream == NULL)
return errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
@@ -46,7 +44,7 @@ search (const char *netname, char *result, int *errnop, int secret)
char *save_ptr;
buffer[sizeof (buffer) - 1] = '\xff';
- p = fgets (buffer, sizeof (buffer), stream);
+ p = fgets_unlocked (buffer, sizeof (buffer), stream);
if (p == NULL)
{
/* End of file or read error. */
@@ -58,7 +56,7 @@ search (const char *netname, char *result, int *errnop, int secret)
{
/* Invalid line in file? Skip remainder of line. */
if (buffer[sizeof (buffer) - 2] != '\0')
- while (getc (stream) != '\n')
+ while (getc_unlocked (stream) != '\n')
continue;
continue;
}