summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-01-12 14:37:24 +0000
committerJakub Jelinek <jakub@redhat.com>2007-01-12 14:37:24 +0000
commit00e3dec8025c93ccde8ed810657e7f2115ddc8cb (patch)
tree30b8f6bdb08d364b986ae3ec3ec7664c520f0ad9 /misc
parentd6220e9ee38c1c9285221b023346201ec5f511b3 (diff)
* nis/nis_table.c (nis_list): If __follow_path fails in the new
code, make sure the nis_freeresult call doesn't crash and that the result is reported correctly. * nis/nis_table.c (nis_list): Handle FOLLOW_PATH | ALL_RESULTS when callback is NULL. * nis/Versions (libnss_nisplus): Add _nss_nisplus_initgroups_dyn@@GLIBC_PRIVATE. * nis/Makefile (libnss_nisplus-routines): Add nisplus-initgroups. * nis/nss_nisplus/nisplus-grp.c (tablename_val, tablename_len, _nss_create_tablename): Rename to... (grp_tablename_val, grp_tablename_len, _nss_grp_create_tablename): ... these. No longer static. (internal_setgrent): Adjust users. (_nss_nisplus_getgrnam_r, _nss_nisplus_getgrgid_r): Likewise. Don't use locking around _nss_grp_create_tablename call. * nis/nss_nisplus/nisplus-initgroups.c: New file.
Diffstat (limited to 'misc')
-rw-r--r--misc/Makefile2
-rw-r--r--misc/getusershell.c12
-rw-r--r--misc/mntent_r.c12
-rw-r--r--misc/tst-pselect.c21
4 files changed, 20 insertions, 27 deletions
diff --git a/misc/Makefile b/misc/Makefile
index 9eac1b6275..f9ad0b76fc 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -78,7 +78,7 @@ endif
gpl2lgpl := error.c error.h
tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
- tst-error1 tst-pselect tst-insremque tst-mntent2
+ tst-error1 tst-pselect tst-insremque
ifeq (no,$(cross-compiling))
tests: $(objpfx)tst-error1-mem
endif
diff --git a/misc/getusershell.c b/misc/getusershell.c
index 636da322f9..255b579b1a 100644
--- a/misc/getusershell.c
+++ b/misc/getusershell.c
@@ -98,7 +98,7 @@ initshells()
register char **sp, *cp;
register FILE *fp;
struct stat64 statb;
- size_t flen;
+ int flen;
free(shells);
shells = NULL;
@@ -114,11 +114,9 @@ initshells()
okshells[1] = _PATH_CSHELL;
return (char **) okshells;
}
- if (statb.st_size > ~(size_t)0 / sizeof (char *) * 3)
+ if ((strings = malloc((u_int)statb.st_size + 1)) == NULL)
goto init_okshells;
- if ((strings = malloc(statb.st_size + 2)) == NULL)
- goto init_okshells;
- shells = malloc(statb.st_size / 3 * sizeof (char *));
+ shells = calloc((unsigned)statb.st_size / 3, sizeof (char *));
if (shells == NULL) {
free(strings);
strings = NULL;
@@ -126,11 +124,11 @@ initshells()
}
sp = shells;
cp = strings;
- flen = statb.st_size + 2;
+ flen = statb.st_size;
while (fgets_unlocked(cp, flen - (cp - strings), fp) != NULL) {
while (*cp != '#' && *cp != '/' && *cp != '\0')
cp++;
- if (*cp == '#' || *cp == '\0' || cp[1] == '\0')
+ if (*cp == '#' || *cp == '\0')
continue;
*sp++ = cp;
while (!isspace(*cp) && *cp != '#' && *cp != '\0')
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 829750b395..1476c86ee2 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -1,6 +1,5 @@
/* Utilities for reading/writing fstab, mtab, etc.
- Copyright (C) 1995-2000, 2001, 2002, 2003, 2006
- Free Software Foundation, Inc.
+ Copyright (C) 1995-2000, 2001, 2002, 2003 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
@@ -279,11 +278,14 @@ __hasmntopt (const struct mntent *mnt, const char *opt)
while ((p = strstr (rest, opt)) != NULL)
{
- if ((p == rest || p[-1] == ',')
- && (p[optlen] == '\0' || p[optlen] == '=' || p[optlen] == ','))
+ if (p == rest
+ || (p[-1] == ','
+ && (p[optlen] == '\0' ||
+ p[optlen] == '=' ||
+ p[optlen] == ',')))
return p;
- rest = strchr (p, ',');
+ rest = strchr (rest, ',');
if (rest == NULL)
break;
++rest;
diff --git a/misc/tst-pselect.c b/misc/tst-pselect.c
index 35d51d8ee0..123c31912e 100644
--- a/misc/tst-pselect.c
+++ b/misc/tst-pselect.c
@@ -29,16 +29,7 @@ do_test (void)
return 1;
}
- sa.sa_handler = SIG_IGN;
- sa.sa_flags = SA_NOCLDWAIT;
-
- if (sigaction (SIGCHLD, &sa, NULL) != 0)
- {
- puts ("2nd sigaction failed");
- return 1;
- }
-
- if (sigblock (sigmask (SIGUSR1)) != 0)
+ if (sigblock (SIGUSR1) != 0)
{
puts ("sigblock failed");
return 1;
@@ -61,7 +52,6 @@ do_test (void)
struct timespec to = { .tv_sec = 0, .tv_nsec = 500000000 };
- pid_t parent = getpid ();
pid_t p = fork ();
if (p == 0)
{
@@ -73,9 +63,6 @@ do_test (void)
int e;
do
{
- if (getppid () != parent)
- exit (2);
-
errno = 0;
e = pselect (fds[0][0] + 1, &rfds, NULL, NULL, &to, &ss);
}
@@ -121,6 +108,12 @@ do_test (void)
return 1;
}
+ if (TEMP_FAILURE_RETRY (waitpid (p, NULL, 0)) != p)
+ {
+ puts ("waitpid failed");
+ return 1;
+ }
+
return 0;
}