This is the mail archive of the libc-alpha@sourceware.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]

Re: [Various] libc/1208: segfault in fclose on fdopen'ed FILE pointer



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

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