From 8a4b65b46966f99180de59141cbfa14de2d80380 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 10 Dec 1996 03:08:06 +0000 Subject: update from main archive 961209 Tue Dec 10 02:17:31 1996 Ulrich Drepper * stdio-common/printf_fp.c (__guess_grouping): Fix of by one error in computation of number of groups. Patch sent by Harald Schreiber . Tue Dec 10 01:50:07 1996 Ulrich Drepper * version.h: Set version to 1.99. * Make-dist (routines): Add malloc and new-malloc. * Makeconfig: Allow Makefiles to set $(CPPFLAGS-$( * Make-dist: Make sure both malloc directories get distributed. Sun Dec 8 23:14:10 1996 Andreas Schwab * libio/iogets.c (_IO_gets): Fix early returns to not leave the stream locked. Sat Dec 7 22:08:09 1996 Andreas Schwab * sysdeps/unix/sysv/linux/sys/module.h: Enclose declarations in __BEGIN_DECLS/__END_DECLS. Sat Dec 7 14:23:12 1996 Andreas Schwab * login/utmp_file.c: Consistently set file_offset to the position after the entry just read. --- libio/iogets.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'libio/iogets.c') diff --git a/libio/iogets.c b/libio/iogets.c index 716ecd1b18..b5611f29da 100644 --- a/libio/iogets.c +++ b/libio/iogets.c @@ -31,13 +31,17 @@ _IO_gets (buf) { _IO_size_t count; int ch; + char *retval; __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, _IO_stdin); _IO_flockfile (_IO_stdin); ch = _IO_getc_unlocked (_IO_stdin); if (ch == EOF) - return NULL; + { + retval = NULL; + goto unlock_return; + } if (ch == '\n') count = 0; else @@ -45,11 +49,16 @@ _IO_gets (buf) buf[0] = (char)ch; count = _IO_getline (_IO_stdin, buf + 1, INT_MAX, '\n', 0) + 1; if (_IO_stdin->_IO_file_flags & _IO_ERR_SEEN) - return NULL; + { + retval = NULL; + goto unlock_return; + } } - __libc_cleanup_region_end (1); buf[count] = 0; - return buf; + retval = buf; +unlock_return: + __libc_cleanup_region_end (1); + return retval; } weak_alias (_IO_gets, gets) -- cgit v1.2.3