From 50304ef0572fb41ba853262046dc7594f6a15241 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 16 Jul 1998 11:44:36 +0000 Subject: Update. 1998-07-16 10:23 Ulrich Drepper * argp/argp-fmtstream.c: Unify names of used global functions. * argp/argp-help.c: Likewise. * assert/assert-perr.c: Likewise * assert/assert.c: Likewise * dirent/scandir.c: Likewise * dirent/scandir64.c: Likewise * dirent/versionsort.c: Likewise * dirent/versionsort64.c: Likewise * gmon/bb_exit_func.c: Likewise. * gmon/gmon.c: Likewise. * grp/initgroups.c: Likewise. * iconv/gconv_conf.c: Likewise. * inet/getnameinfo.c: Likewise. * inet/getnetgrent_r.c: Likewise. * inet/inet_ntoa.c: Likewise. * inet/rcmd.c: Likewise. * inet/rexec.c: Likewise. * inet/ruserpass.c: Likewise. * io/fts.c: Likewise. * io/ftw.c: Likewise. * io/ftw64.c: Likewise. * io/getdirname.c: Likewise. * io/getwd.c: Likewise. * io/lockf.c: Likewise. * libio/iofdopen.c: Likewise. * libio/iopopen.c: Likewise. * login/utmp_daemon.c: Likewise. * malloc/mtrace.c: Likewise. * malloc/obstack.c * misc/daemon.c: Likewise. * misc/efgcvt_r.c: Likewise. * misc/err.c: Likewise. * misc/error.c: Likewise. * misc/fstab.c: Likewise. * misc/getpass.c: Likewise. * misc/getttyent.c: Likewise. * misc/mntent_r.c: Likewise. * misc/search.h: Likewise. * misc/syslog.c: Likewise. * nscd/nscd_getgr_r.c: Likewise. * nscd/nscd_getpw_r.c: Likewise. * posix/getpgrp.c: Likewise. * posix/wordexp.c: Likewise. * pwd/fgetpwent_r.c: Likewise. * pwd/getpw.c: Likewise. * resolv/herror.c: Likewise. * resolv/res_init.c: Likewise. * shadow/fgetspent_r.c: Likewise. * shadow/lckpwdf.c: Likewise. * signal/sigrelse.c: Likewise. * stdio-common/asprintf.c: Likewise. * stdio-common/dprintf.c: Likewise. * stdio-common/getw.c: Likewise. * stdio-common/putw.c: Likewise. * stdio-common/snprintf.c: Likewise. * stdio-common/sprintf.c: Likewise. * stdio-common/sscanf.c: Likewise. * stdlib/lrand48_r.c: Likewise. * stdlib/mrand48_r.c: Likewise. * string/argz-replace.c: Likewise. * string/envz.c: Likewise. * sunrpc/auth_des.c: Likewise. * sunrpc/auth_unix.c: Likewise. * sunrpc/bindrsvprt.c: Likewise. * sunrpc/clnt_gen.c: Likewise. * sunrpc/clnt_perr.c: Likewise. * sunrpc/clnt_simp.c: Likewise. * sunrpc/clnt_tcp.c: Likewise. * sunrpc/clnt_udp.c: Likewise. * sunrpc/get_myaddr.c: Likewise. * sunrpc/key_call.c: Likewise. * sunrpc/netname.c: Likewise. * sunrpc/openchild.c: Likewise. * sunrpc/pmap_rmt.c: Likewise. * sunrpc/rpc_dtable.c: Likewise. * sunrpc/rtime.c: Likewise. * sunrpc/svc_run.c: Likewise. * sunrpc/svc_simple.c: Likewise. * sunrpc/svc_tcp.c: Likewise. * sunrpc/svc_udp.c: Likewise. * sunrpc/svcauth_des.c: Likewise. * sunrpc/xdr_array.c: Likewise. * sunrpc/xdr_rec.c: Likewise. * sunrpc/xdr_ref.c: Likewise. * sunrpc/xdr_stdio.c: Likewise. * sysdeps/generic/abort.c: Likewise. * sysdeps/generic/dl-sysdep.c: Likewise. * sysdeps/generic/fstatfs64.c: Likewise. * sysdeps/generic/ftruncate64.c: Likewise. * sysdeps/generic/getrlimit64.c: Likewise. * sysdeps/generic/glob.c: Likewise. * sysdeps/generic/prof-freq.c: Likewise. * sysdeps/generic/putenv.c: Likewise. * sysdeps/generic/statfs64.c: Likewise. * sysdeps/generic/ttyname_r.c: Likewise. * sysdeps/generic/utmp_file.c: Likewise. * sysdeps/generic/vlimit.c: Likewise. * sysdeps/generic/vtimes.c: Likewise. * sysdeps/posix/cuserid.c: Likewise. * sysdeps/posix/euidaccess.c: Likewise. * sysdeps/posix/mkstemp.c: Likewise. * sysdeps/posix/mktemp.c: Likewise. * sysdeps/posix/pread.c: Likewise. * sysdeps/posix/pread64.c: Likewise. * sysdeps/posix/profil.c: Likewise. * sysdeps/posix/pwrite.c: Likewise. * sysdeps/posix/pwrite64.c: Likewise. * sysdeps/posix/sigblock.c: Likewise. * sysdeps/posix/sigpause.c: Likewise. * sysdeps/posix/ttyname.c: Likewise. * sysdeps/posix/ttyname_r.c: Likewise. * sysdeps/posix/waitid.c: Likewise. * sysdeps/unix/getlogin_r.c: Likewise. * sysdeps/unix/grantpt.c: Likewise. * sysdeps/unix/rewinddir.c: Likewise. * sysdeps/unix/sysv/linux/gethostid.c: Likewise. * sysdeps/unix/sysv/linux/getpt.c: Likewise. * sysdeps/unix/sysv/linux/if_index.c: Likewise. * sysdeps/unix/sysv/linux/ptsname.c: Likewise. * sysdeps/unix/sysv/linux/sendmsg.c: Likewise. * sysdeps/unix/sysv/linux/statvfs.c: Likewise. * sysdeps/unix/sysv/linux/ttyname.c: Likewise. * sysdeps/unix/sysv/linux/ttyname_r.c: Likewise. * sysdeps/unix/sysv/linux/ulimit.c: Likewise. * sysdeps/unix/sysv/linux/unlockpt.c: Likewise. * sysvipc/sys/shm.h: Likewise. * time/ctime_r.c: Likewise. * time/strptime.c: Likewise. * wcsmbs/mbrlen.c: Likewise. * wcsmbs/wcsdup.c: Likewise. * wcsmbs/wcsxfrm.c: Likewise. * wctype/wcfuncs.c: Likewise. * sysdeps/unix/sysv/linux/i386/socker.S: Change to honor NO_WEAK_ALIAS. * sysdeps/unix/sysv/linux/accept.S: Don't generate __ name. * sysdeps/unix/sysv/linux/bind.S: Likewise. * sysdeps/unix/sysv/linux/getsockname.S: Likewise. * sysdeps/unix/sysv/linux/listen.S: Likewise. * sysdeps/unix/sysv/linux/recvfrom.S: Likewise. * sysdeps/unix/sysv/linux/sendto.S: Likewise. * sysdeps/unix/sysv/linux/setsockopt.S: Likewise. * grp/fgetgrent_r.c: Use explicit locking of the stream. * elf/Makefile (rtld-routines): Add dl-environ. * sysdeps/generic/dl-environ.c: New file. * libio/Makefile [REENTRANT] (routines): Add iofputs_u. * libio/Versions: Add fputs_unlocked. * libio/iofputs_u.c: New file. * libio/stdio.h: Add prototype for fputs_unlocked. * sunrpc/rpc/auth.h: Use __PMT instead of __P in type definitions. * sunrpc/rpc/clnt.h: Likewise. * sunrpc/rpc/pmap_clnt.h: Likewise. * sunrpc/rpc/svc.h: Likewise. * sunrpc/rpc/xdr.h: Likewise. * sysdeps/i386/memchr.S: Correct for more strict gas. * sysdeps/i386/fpu/bits/mathinline.h: Likewise. * sysdeps/libm-i387/i686/s_fdim.S: Likewise. * sysdeps/libm-i387/i686/s_fdimf.S: Likewise. * sysdeps/libm-i387/i686/s_fdiml.S: Likewise. 1998-07-15 Andreas Jaeger * configure.in: Change message for binutils version from 2.8.1.0.17->2.8.1.0.23. 1998-07-15 Ulrich Drepper * sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h: Define LOC. Patch by John Tobey . --- shadow/fgetspent_r.c | 13 +++++++++++-- shadow/lckpwdf.c | 22 +++++++++++----------- 2 files changed, 22 insertions(+), 13 deletions(-) (limited to 'shadow') diff --git a/shadow/fgetspent_r.c b/shadow/fgetspent_r.c index bf4a3f8c08..bedc36182e 100644 --- a/shadow/fgetspent_r.c +++ b/shadow/fgetspent_r.c @@ -21,6 +21,10 @@ #include #include +#ifdef USE_IN_LIBIO +# define flockfile(s) _IO_flockfile (s) +#endif + /* Define a line parsing function using the common code used in the nss_files module. */ @@ -39,17 +43,20 @@ __fgetspent_r (FILE *stream, struct spwd *resbuf, char *buffer, size_t buflen, { char *p; + flockfile (stream); do { buffer[buflen - 1] = '\xff'; - p = fgets (buffer, buflen, stream); - if (p == NULL && feof (stream)) + p = fgets_unlocked (buffer, buflen, stream); + if (p == NULL && feof_unlocked (stream)) { + funlockfile (stream); *result = NULL; return errno; } if (p == NULL || buffer[buflen - 1] != '\xff') { + funlockfile (stream); *result = NULL; return errno = ERANGE; } @@ -62,6 +69,8 @@ __fgetspent_r (FILE *stream, struct spwd *resbuf, char *buffer, size_t buflen, get the next line of the file to parse. */ ! parse_line (buffer, (void *) resbuf, NULL, 0, &errno)); + funlockfile (stream); + *result = resbuf; return 0; } diff --git a/shadow/lckpwdf.c b/shadow/lckpwdf.c index 885ac54bf6..861e0e0cd2 100644 --- a/shadow/lckpwdf.c +++ b/shadow/lckpwdf.c @@ -1,5 +1,5 @@ /* Handle locking of password file. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -52,7 +52,7 @@ static void noop_handler __P ((int __sig)); do { \ if ((code) < 0 && lock_fd >= 0) \ { \ - close (lock_fd); \ + __close (lock_fd); \ lock_fd = -1; \ } \ __libc_lock_unlock (lock); \ @@ -63,7 +63,7 @@ static void noop_handler __P ((int __sig)); do { \ /* Restore old action handler for alarm. We don't need to know \ about the current one. */ \ - sigaction (SIGALRM, &saved_act, NULL); \ + __sigaction (SIGALRM, &saved_act, NULL); \ RETURN_CLOSE_FD (code); \ } while (0) @@ -73,7 +73,7 @@ static void noop_handler __P ((int __sig)); alarm (0); \ /* Restore old set of handled signals. We don't need to know \ about the current one.*/ \ - sigprocmask (SIG_SETMASK, &saved_set, NULL); \ + __sigprocmask (SIG_SETMASK, &saved_set, NULL); \ RETURN_RESTORE_HANDLER (code); \ } while (0) @@ -96,18 +96,18 @@ __lckpwdf () /* Prevent problems caused by multiple threads. */ __libc_lock_lock (lock); - lock_fd = open (PWD_LOCKFILE, O_WRONLY | O_CREAT, 0600); + lock_fd = __open (PWD_LOCKFILE, O_WRONLY | O_CREAT, 0600); if (lock_fd == -1) /* Cannot create lock file. */ RETURN_CLOSE_FD (-1); /* Make sure file gets correctly closed when process finished. */ - flags = fcntl (lock_fd, F_GETFD, 0); + flags = __fcntl (lock_fd, F_GETFD, 0); if (flags == -1) /* Cannot get file flags. */ RETURN_CLOSE_FD (-1); flags |= FD_CLOEXEC; /* Close on exit. */ - if (fcntl (lock_fd, F_SETFD, flags) < 0) + if (__fcntl (lock_fd, F_SETFD, flags) < 0) /* Cannot set new flags. */ RETURN_CLOSE_FD (-1); @@ -125,14 +125,14 @@ __lckpwdf () new_act.sa_flags = 0ul; /* Install new action handler for alarm and save old. */ - if (sigaction (SIGALRM, &new_act, &saved_act) < 0) + if (__sigaction (SIGALRM, &new_act, &saved_act) < 0) /* Cannot install signal handler. */ RETURN_CLOSE_FD (-1); /* Now make sure the alarm signal is not blocked. */ sigemptyset (&new_set); sigaddset (&new_set, SIGALRM); - if (sigprocmask (SIG_UNBLOCK, &new_set, &saved_set) < 0) + if (__sigprocmask (SIG_UNBLOCK, &new_set, &saved_set) < 0) RETURN_RESTORE_HANDLER (-1); /* Start timer. If we cannot get the lock in the specified time we @@ -143,7 +143,7 @@ __lckpwdf () memset (&fl, '\0', sizeof (struct flock)); fl.l_type = F_WRLCK; fl.l_whence = SEEK_SET; - result = fcntl (lock_fd, F_SETLKW, &fl); + result = __fcntl (lock_fd, F_SETLKW, &fl); RETURN_CLEAR_ALARM (result); } @@ -163,7 +163,7 @@ __ulckpwdf () /* Prevent problems caused by multiple threads. */ __libc_lock_lock (lock); - result = close (lock_fd); + result = __close (lock_fd); /* Mark descriptor as unused. */ lock_fd = -1; -- cgit 1.4.1