Messages in this thread | | | Date | Sun, 23 Aug 1998 20:38:51 -0700 (PDT) | From | Marc Slemko <> | Subject | Re: Bug in kernel or libc !? |
| |
Why do you think there is any bug?
[...] bank = fopen("test","r+");
You open a file using stdio.
fseek(bank,0L,0); fread(buf,512,1,bank); fseek(bank,0L,0);
You read the data from it then to back to the start.
//fflush(bank); //uncoment this for bugfix ftruncate( fileno(bank), 0 );
You do something bad by improperly using stdio; before you can do anything with fileno() you need to fflush the stream. The Solaris man page for stdio has a reasonable discussion of this.
Any behaviour now is undefined because you are mixing stdio and non-stdio on the same descriptor without proper caution.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html
| |