mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-10 15:20:10 +00:00
00bc5db059
1998-09-18 17:41 Ulrich Drepper <drepper@cygnus.com> * libio/fileops.c (_IO_new_file_underflow): Before allocating buffer make sure the pushback buffer is destroyed. (_IO_new_file_seekoff): Likewise. If mode==0 quit early with the result. Clear OEF flag after successful fseek. * libio/libio.h (_IO_FILE_complete): Add _IO_save_ptr. * libio/ftello.c (ftello): Add offset from original buffer if stream has pushed back characters. * libio/ftello64.c (ftello64): Likewise. * libio/iofgetpos.c (_IO_fgetpos): Likewise. * libio/iofgetpos64.c (_IO_fgetpos64): Likewise. * libio/ioftell.c (_IO_ftell): Likewise. * libio/genops.c (_IO_switch_to_main_get_area): Swap _IO_read_ptr and _IO_save_ptr. (_IO_switch_to_backup_area): Save _IO_read_ptr in _IO_save_ptr. (_IO_default_pbackfail): Only stored push back character in original buffer if it is the same as the one in the file at this position. * libio/iofclose.c: Free backup buffer if one is available. * libio/ioseekoff.c (_IO_seekoff): Only remove pushback buffer if mode!=0. * strdlib/strtol.c (strtol): Handle 0x... string for base!=0 correctly. * time/strftime.c [_LIBC] (ampm): Use tp->tm_hour not hour12. 1998-09-18 Mark Kettenis <kettenis@phys.uva.nl> * login/programs/pt_chown.c (more_help): Correct message that describes the purpose of the program. * login/openpty.c: Do not include pty-private.h. (pts_name): New function. Return name of slave pseudo terminal in an allocated buffer if necessary. (openpty): Use pts_name to get name of the slave end of the pseudo terminal pair. * sysdeps/unix/grantpt.c (grantpt): Free buffer allocated by pts_name before return. 1998-09-18 11:15 Ulrich Drepper <drepper@cygnus.com> * math/math.h: Define __NO_MATH_INLINES if __STRICT_ANSI__.
69 lines
2.1 KiB
C
69 lines
2.1 KiB
C
/* Copyright (C) 1993, 1995, 1997, 1998 Free Software Foundation, Inc.
|
|
This file is part of the GNU IO Library.
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License as
|
|
published by the Free Software Foundation; either version 2, or (at
|
|
your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful, but
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this library; see the file COPYING. If not, write to
|
|
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
|
MA 02111-1307, USA.
|
|
|
|
As a special exception, if you link this library with files
|
|
compiled with a GNU compiler to produce an executable, this does
|
|
not cause the resulting executable to be covered by the GNU General
|
|
Public License. This exception does not however invalidate any
|
|
other reasons why the executable file might be covered by the GNU
|
|
General Public License. */
|
|
|
|
#include "libioP.h"
|
|
#ifdef __STDC__
|
|
#include <stdlib.h>
|
|
#endif
|
|
|
|
int
|
|
_IO_new_fclose (fp)
|
|
_IO_FILE *fp;
|
|
{
|
|
int status;
|
|
|
|
CHECK_FILE(fp, EOF);
|
|
|
|
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
|
|
_IO_flockfile (fp);
|
|
if (fp->_IO_file_flags & _IO_IS_FILEBUF)
|
|
status = _IO_file_close_it (fp);
|
|
else
|
|
status = fp->_flags & _IO_ERR_SEEN ? -1 : 0;
|
|
_IO_FINISH (fp);
|
|
_IO_funlockfile (fp);
|
|
_IO_cleanup_region_end (0);
|
|
if (_IO_have_backup (fp))
|
|
_IO_free_backup_area (fp);
|
|
if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr)
|
|
{
|
|
fp->_IO_file_flags = 0;
|
|
free(fp);
|
|
}
|
|
|
|
return status;
|
|
}
|
|
|
|
#if defined PIC && DO_VERSIONING
|
|
strong_alias (_IO_new_fclose, __new_fclose)
|
|
default_symbol_version (_IO_new_fclose, _IO_fclose, GLIBC_2.1);
|
|
default_symbol_version (__new_fclose, fclose, GLIBC_2.1);
|
|
#else
|
|
# ifdef weak_alias
|
|
weak_alias (_IO_new_fclose, _IO_fclose)
|
|
weak_alias (_IO_new_fclose, fclose)
|
|
# endif
|
|
#endif
|