aboutsummaryrefslogtreecommitdiff
path: root/nss/nss_files
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
commita334319f6530564d22e775935d9c91663623a1b4 (patch)
treeb5877475619e4c938e98757d518bb1e9cbead751 /nss/nss_files
parent0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff)
downloadglibc-a334319f6530564d22e775935d9c91663623a1b4.zip
glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz
glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.bz2
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'nss/nss_files')
-rw-r--r--nss/nss_files/files-alias.c6
-rw-r--r--nss/nss_files/files-hosts.c10
-rw-r--r--nss/nss_files/files-key.c3
-rw-r--r--nss/nss_files/files-netgrp.c26
4 files changed, 17 insertions, 28 deletions
diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c
index c4717e1..8ee54f1 100644
--- a/nss/nss_files/files-alias.c
+++ b/nss/nss_files/files-alias.c
@@ -1,5 +1,5 @@
/* Mail alias file parser in nss_files module.
- Copyright (C) 1996,97,98,99,2002,2006 Free Software Foundation, Inc.
+ Copyright (C) 1996,97,98,99,2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -298,8 +298,8 @@ get_next_alias (const char *match, struct aliasent *result,
first_unused[room_left - 1] = '\0';
strncpy (first_unused, old_line, room_left);
- free (old_line);
- line = first_unused;
+ if (old_line != NULL)
+ free (old_line);
if (first_unused[room_left - 1] != '\0')
goto no_more_room;
diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c
index b1ba3aa..8d1a8ee 100644
--- a/nss/nss_files/files-hosts.c
+++ b/nss/nss_files/files-hosts.c
@@ -1,6 +1,5 @@
/* Hosts file parser in nss_files module.
- Copyright (C) 1996-2001, 2003, 2004, 2007
- Free Software Foundation, Inc.
+ Copyright (C) 1996-2001, 2003, 2004 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
@@ -87,10 +86,6 @@ _nss_files_get##name##_r (proto, \
{ \
enum nss_status status; \
\
- uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct hostent_data); \
- buffer += pad; \
- buflen = buflen > pad ? buflen - pad : 0; \
- \
__libc_lock_lock (lock); \
\
/* Reset file pointer to beginning or open file. */ \
@@ -111,8 +106,7 @@ _nss_files_get##name##_r (proto, \
{ \
/* We have to get all host entries from the file. */ \
const size_t tmp_buflen = MIN (buflen, 4096); \
- char tmp_buffer[tmp_buflen] \
- __attribute__ ((__aligned__ (__alignof__ (struct hostent_data))));\
+ char tmp_buffer[tmp_buflen]; \
struct hostent tmp_result_buf; \
int naddrs = 1; \
int naliases = 0; \
diff --git a/nss/nss_files/files-key.c b/nss/nss_files/files-key.c
index 5c7ad09..f00fc1c 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 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
@@ -78,7 +78,6 @@ search (const char *netname, char *result, int *errnop, int secret)
p = __strtok_r (NULL, ":\n", &save_ptr);
if (p == NULL) /* malformed line? */
continue;
- fclose (stream);
strcpy (result, p);
return NSS_STATUS_SUCCESS;
}
diff --git a/nss/nss_files/files-netgrp.c b/nss/nss_files/files-netgrp.c
index 4b5d774..8bdc68b 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 <drepper@cygnus.com>, 1996.
@@ -22,7 +22,6 @@
#include <errno.h>
#include <netdb.h>
#include <stdio.h>
-#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#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)