From 71412a8c76fe28a62a2acf243f5ae4e91ddf632e Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 5 Jul 1998 12:05:16 +0000 Subject: Update. 1998-07-05 11:49 Ulrich Drepper * iconv/gconv_conf.c (read_conf_file): Use feof_unlocked on private stream. * inet/ruserpass.c (token): Likewise. * nss/nsswitch.c (nss_parse_file): Likewise. * intl/localealias.c: Likewise. Also for ferror. * time/getdate.c (__getdate_r): Likewise. * libio/Makefile (routines): Add iofgets_u. * libio/iofgets_u.c: New file. * libio/Versions: Add fgets_unlocked. * libio/stdio.h: Add prototype for fgets_unlocked. * misc/getttyent.c (getttyent): Use fgets_unlocked instead of fgets. * misc/getusershell.c (initshells): Likewise. * misc/mntent_r.c (__getmntent_r): Explicitly lock stream. Use fgets_unlocked. * nss/nss_files/files-XXX.c (internal_getent): Likewise. * resolv/res_init.c (res_init): Likewise. * sysdeps/unix/sysv/linux/getsysstats.c: Likewise. --- misc/getusershell.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'misc/getusershell.c') diff --git a/misc/getusershell.c b/misc/getusershell.c index 6b210b68ff..d822f554ea 100644 --- a/misc/getusershell.c +++ b/misc/getusershell.c @@ -96,6 +96,7 @@ initshells() register char **sp, *cp; register FILE *fp; struct stat statb; + int flen; if (shells != NULL) free(shells); @@ -122,7 +123,8 @@ initshells() } sp = shells; cp = strings; - while (fgets(cp, statb.st_size - (cp - strings), fp) != NULL) { + flen = statb.st_size; + while (fgets_unlocked(cp, flen - (cp - strings), fp) != NULL) { while (*cp != '#' && *cp != '/' && *cp != '\0') cp++; if (*cp == '#' || *cp == '\0') -- cgit v1.2.3