This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: [Various] libc/1208: segfault in fclose on fdopen'ed FILE pointer
- To: james@and.org
- Subject: Re: [Various] libc/1208: segfault in fclose on fdopen'ed FILE pointer
- From: Andreas Jaeger <aj@arthur.rhein-neckar.de>
- Date: 18 Jul 1999 22:50:18 +0200
- Cc: libc-alpha Mailinglist <libc-alpha@sourceware.cygnus.com>, Sascha Schumann <sascha@schumann.cx>
- References: <u8yagdsxqq.fsf@arthur.rhein-neckar.de> <nnzp0tagmq.fsf@code.and.org>
Hi James,
you replied privatly to me. I hope you don't mind that I answer your
email publically again since it really looks helpful.
>>>>> James Antill writes:
James> Andreas Jaeger <aj@arthur.rhein-neckar.de> writes:
>> [1 <text/plain>]
>>
>> I'm clueless now - and neither have time to investigate further:-(.
>> Sascha send a bug report and we've exchanged a number of emails. I'm
>> appending all of them.
>>
>> I'd really appreciate if somebody would look into this and help to fix
>> the problem.
James> I don't know glibc, _but_ the sample program looks buggy to me...
>> >How-To-Repeat:
>> #include <stdio.h>
>> #include <sys/types.h>
>> #include <sys/stat.h>
>> #include <fcntl.h>
>> #include <unistd.h>
>>
>> main() {
>> int f;
>> FILE *f2;
>>
>> f = open("/dev/stdin", O_RDONLY);
>> f2 = fdopen(f, "r");
>> fclose(f2);
>> close(f);
>> }%0
James> My man page says that fdopen _doesn't_ dup the fd ... so doing the
James> close is bogus ... and if egcs-1.1.2 has re-ordered the close/fclose
James> that might give a SEGV ?
That might be the problem. Sascha, could you investigate this?
Andreas
--
Andreas Jaeger aj@arthur.rhein-neckar.de jaeger@informatik.uni-kl.de
for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de