From a334319f6530564d22e775935d9c91663623a1b4 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 22 Dec 2004 20:10:10 +0000 Subject: (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4. --- nss/nss_files/files-netgrp.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'nss/nss_files/files-netgrp.c') diff --git a/nss/nss_files/files-netgrp.c b/nss/nss_files/files-netgrp.c index 4b5d774fdd..8bdc68bd14 100644 --- a/nss/nss_files/files-netgrp.c +++ b/nss/nss_files/files-netgrp.c @@ -1,5 +1,5 @@ /* Netgroup file parser in nss_files modules. - Copyright (C) 1996, 1997, 2000, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2000, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include "nsswitch.h" @@ -30,7 +29,6 @@ #define DATAFILE "/etc/netgroup" -libnss_files_hidden_proto (_nss_files_endnetgrent) #define EXPAND(needed) \ do \ @@ -77,9 +75,7 @@ _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)) + while (!feof (fp)) { ssize_t curlen = getline (&line, &line_len, fp); int found; @@ -144,26 +140,26 @@ _nss_files_setnetgrent (const char *group, struct __netgrent *result) /* We don't need the file and the line buffer anymore. */ free (line); fclose (fp); - - if (status != NSS_STATUS_SUCCESS) - _nss_files_endnetgrent (result); } return status; } -enum nss_status +int _nss_files_endnetgrent (struct __netgrent *result) { /* Free allocated memory for data if some is present. */ - free (result->data); - result->data = NULL; - result->data_size = 0; - result->cursor = NULL; + if (result->data != NULL) + { + free (result->data); + result->data = NULL; + result->data_size = 0; + result->cursor = NULL; + } + return NSS_STATUS_SUCCESS; } -libnss_files_hidden_def (_nss_files_endnetgrent) static char * strip_whitespace (char *str) -- cgit v1.2.3