1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
1998-07-05 11:49  Ulrich Drepper  <drepper@cygnus.com>

	* 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.
This commit is contained in:
Ulrich Drepper
1998-07-05 12:05:16 +00:00
parent 6777b467ce
commit 71412a8c76
9 changed files with 39 additions and 13 deletions

View File

@ -1,5 +1,5 @@
/* Utilities for reading/writing fstab, mtab, etc.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1995, 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
@ -51,11 +51,12 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
{
char *head;
flockfile (stream);
do
{
char *end_ptr;
if (fgets (buffer, bufsiz, stream) == NULL)
if (fgets_unlocked (buffer, bufsiz, stream) == NULL)
return NULL;
end_ptr = strchr (buffer, '\n');
@ -65,7 +66,7 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
{
/* Not the whole line was read. Do it now but forget it. */
char tmp[1024];
while (fgets (tmp, sizeof tmp, stream) != NULL)
while (fgets_unlocked (tmp, sizeof tmp, stream) != NULL)
if (strchr (tmp, '\n') != NULL)
break;
}
@ -92,6 +93,7 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
mp->mnt_passno = 0;
case 2:
}
funlockfile (stream);
return mp;
}