This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

fclose(stdout)


The following case crashes with a SEGV on my glibc 2.1 system. But I can't
see any changes in 2.1.1 that would have fixed this. Any ideas?

#include <stdio.h>

int main()
{
    printf("hi\n");
    fclose(stdout);
    return 0;
}

Program received signal SIGSEGV, Segmentation fault.
0x4006aa70 in _IO_new_fclose (fp=0x8049630) at iofclose.c:45
iofclose.c:45: No such file or directory.
(gdb) bt
#0  0x4006aa70 in _IO_new_fclose (fp=0x8049630) at iofclose.c:45
#1  0x80484da in main () at fff.c:6
(gdb) p *fp
$1 = {_flags = -72539124, _IO_read_ptr = 0x0, _IO_read_end = 0x0,
_IO_read_base = 0x0, 
  _IO_write_base = 0x0, _IO_write_ptr = 0x0, _IO_write_end = 0x0,
_IO_buf_base = 0x0, 
  _IO_buf_end = 0x0, _IO_save_base = 0x0, _IO_backup_base = 0x0,
_IO_save_end = 0x0, 
  _markers = 0x0, _chain = 0x40102400, _fileno = -1, _blksize = 0,
_old_offset = -1, 
  _cur_column = 0, _vtable_offset = -72 '¸', _shortbuf = "", _lock =
0x40102450, _offset = -1, 
  _unused2 = {0, 0, 134518092, 0, 0, 1074810016, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0}}
(gdb) p stdout
$2 = (FILE *) 0x8049630

As a result of this a rebuild of egcs cpp now segfaults the same way at
cccp.c:2183 (current CVS). I have the impression that this probably *is*
fixed, so its just a matter of knowing where/when. Ideas? Installation
problem?

Jifl
-- 
Cygnus Solutions, 35 Cambridge Place, Cambridge, UK.  Tel: +44 (1223) 728762
"I used to have an open mind but || Get yer free open source RTOS's here...
 my brains kept falling out."    || http://sourceware.cygnus.com/ecos
Help fight spam! http://spam.abuse.net/  These opinions are all my own fault

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]