This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Linux Portability Issues
- From: "Sapna Modi" <sapnam at lsrc dot mahyco dot com>
- To: John Love-Jensen <eljay at adobe dot com>, gcc-help at gcc dot gnu dot org
- Cc: abhayk at lsrc dot mahyco dot com
- Date: Fri, 6 Jun 2003 16:51:03 GMT+5.30
- Subject: Re: Linux Portability Issues
- Organization: Maharashtra Hybrid Seeds Co. Ltd.
- References: <182F55B73C1@lsrc.mahyco.com>
Hello,
Thanks for the reply. The core file is not with me. So that I couldn't
check.
As I already said mine software is working very nicely on RH linux
7.1 with glibc version glibc-2.2.2-10.
And now on RH linux 9.0, the glibc version is glibc-2.3.2-11.9, it is
giving problem of segmentation fault.
>From the output of gdb, it shows problem in fclose@glic....
Program received signal SIGSEGV, Segmentation fault.
0x42061367 in fclose@@GLIBC_2.1 () from /lib/tls/libc.so.6
(gdb)
So is it the case that with the changed version of glibc, the
software is not running.
Following is the part of the code that refers to fclose---
#include<stdio.h>
FILE *fd; /* file pointer */
fd=fopen("test.txt","r"); /* open the file */
if(fd == NULL)
{
printf("\n Error in opening the file");
exit(1);
}
while(feof(fd) == 0)
{ /* while */
/* some code */
} /* end while */
if(feof(fd) != 0)
{
clearerr(fd);
}
if(fclose(fd) == 0)
{
printf("\n Successfully closed file");
}
printf("\n main end"); /* #testing */
} /* end main */
Please help.
--Sapna
---------------------------0--o--0--o--0--o--0----------------------------------------------
Learn By Listening. Understand By Reflecting.
---------------------------0--o--0--o--0--o--0----------------------------------------------
On 5 Jun 03, at 6:24, John Love-Jensen wrote:
Hi Sapna,
Probably a lurking bug in the code. (Your code? GCC? Other? Don't know.)
To solve the problem, use gdb to look at the core file and see where it
crashed. Assuming you have a core file on hand.
If that doesn't help you figure out why it crashed, use gdb to step through
the code.
Good luck,
--Eljay