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


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

fclose behaves different



Hello,

I have got an interrested bug report to SuSE:

/* -- begin stupid demo -- */

#include<stdio.h>

int
main(void)
{
        FILE *fp=NULL;

        fp=fopen("/etc/passwd", "r");

        printf("%d\n", fclose(fp));
        printf("%d\n", fclose(fp)); /* segfault here */

        return 0;
}

/* -- end stupid demo -- */

If I compile this program static, the second fclose returns -1,
if I link it dynamic, I get an seg.fault. Don't know why, but
we should always return the same (-1 or seg.fault).

  Thorsten
-- 
Thorsten Kukuk      http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE GmbH           Schanzaeckerstr. 10             90443 Nuernberg
Linux is like a Vorlon.  It is incredibly powerful, gives terse,
cryptic answers and has a lot of things going on in the background.


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