public inbox for insight-prs@sourceware.org
help / color / mirror / Atom feed
* insight/93: stdio.h problems : fopen() returns no adress unless file is called toto.txt !!!
@ 2001-06-23  7:43 fabien
  0 siblings, 0 replies; 2+ messages in thread
From: fabien @ 2001-06-23  7:43 UTC (permalink / raw)
  To: insight-gnats

>Number:         93
>Category:       insight
>Synopsis:       stdio.h problems : fopen() returns no adress unless file is called toto.txt !!!
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 23 07:43:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Fabien Wernli
>Release:        insight-5
>Organization:
>Environment:
suse linux 7.0 i386
>Description:
Program compiles correctly and runs correctly when not in debug mode with gdb/insight (works ok with ddd and gdb4.7)

when using insight, fopen() command returns address only if the file is called toto.txt. Call it toto2.txt, and it fails, so fclose() returns seg,entation fault!!

create any toto.txt -> works
change program with toto2.txt -> ssigsev with gdb!!!
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="text.c.txt"
Content-Disposition: inline; filename="text.c.txt"

#include <stdio.h>

main()
{
	FILE *fileman;

	fileman = fopen("toto.txt", "r");
	feof(fileman);
	fclose(fileman);
}


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: insight/93: stdio.h problems : fopen() returns no adress unless file is called toto.txt !!!
@ 2002-01-04 14:01 kseitz
  0 siblings, 0 replies; 2+ messages in thread
From: kseitz @ 2002-01-04 14:01 UTC (permalink / raw)
  To: fabien, insight-prs, kseitz, nobody

Synopsis: stdio.h problems : fopen() returns no adress unless file is called toto.txt !!!

Responsible-Changed-From-To: unassigned->kseitz
Responsible-Changed-By: kseitz
Responsible-Changed-When: Fri Jan  4 14:01:04 2002
Responsible-Changed-Why:
    got it
State-Changed-From-To: open->closed
State-Changed-By: kseitz
State-Changed-When: Fri Jan  4 14:01:04 2002
State-Changed-Why:
    Um.. Look at your program. It is doing exactly what it should be doing.
    
    You're opening "toto.txt". When that file is not found, fopen returns NULL, which is then blindly passed to feof, which segfaults on the NULL.
    
    What do you expect to happen? On my Red Hat linux 7.0 box, your program also crashes (with or without Insight).

http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=93&database=insight


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-04 22:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-23  7:43 insight/93: stdio.h problems : fopen() returns no adress unless file is called toto.txt !!! fabien
2002-01-04 14:01 kseitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).