[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug binutils/136] New: BFD crashes when cached file can't be reopen
From: |
Nick Clifton |
Subject: |
Re: [Bug binutils/136] New: BFD crashes when cached file can't be reopened |
Date: |
Wed, 05 May 2004 16:52:08 +0100 |
User-agent: |
Mozilla Thunderbird 0.5 (X11/20040208) |
Hi Mikulas,
BFD keeps cache of files and has only few files open at a time. When the file is
not in open-descriptor cache, BFD reopens it. BFD crashes trying to work with
NULL FILE * pointer, when reopening file fails.
Actually, since bfd_cache_lookup() no longer returns NULL we can remove
the pieces of code that used to check for this. Hence I am also going
to apply this patch.
Cheers
Nick
bfd/ChangeLog
2004-05-05 Nick Clifton <address@hidden>
PR/136
* hppabsd-core.c (hppabsd_core_core_file_p): Do not check result
of bfd_cache_lookup().
* sco5-core.c (sco5_core_file_p): Likewise.
* trad-core.c (trad_unix_core_file_p): Likewise.
Index: bfd/hppabsd-core.c
===================================================================
RCS file: /cvs/src/src/bfd/hppabsd-core.c,v
retrieving revision 1.11
diff -c -3 -p -r1.11 hppabsd-core.c
*** bfd/hppabsd-core.c 15 Mar 2004 14:21:42 -0000 1.11
--- bfd/hppabsd-core.c 5 May 2004 15:44:29 -0000
*************** hppabsd_core_core_file_p (abfd)
*** 139,145 ****
{
FILE *stream = bfd_cache_lookup (abfd);
struct stat statbuf;
! if (stream == NULL || fstat (fileno (stream), &statbuf) < 0)
{
bfd_set_error (bfd_error_system_call);
return NULL;
--- 139,146 ----
{
FILE *stream = bfd_cache_lookup (abfd);
struct stat statbuf;
!
! if (fstat (fileno (stream), &statbuf) < 0)
{
bfd_set_error (bfd_error_system_call);
return NULL;
Index: bfd/sco5-core.c
===================================================================
RCS file: /cvs/src/src/bfd/sco5-core.c,v
retrieving revision 1.11
diff -c -3 -p -r1.11 sco5-core.c
*** bfd/sco5-core.c 15 Mar 2004 14:21:43 -0000 1.11
--- bfd/sco5-core.c 5 May 2004 15:44:29 -0000
*************** sco5_core_file_p (abfd)
*** 123,135 ****
char *secname;
flagword flags;
! /* Read coreoffsets region at end of core (see core(FP)) */
{
FILE *stream = bfd_cache_lookup (abfd);
struct stat statbuf;
! if (stream == NULL)
! return NULL;
if (fstat (fileno (stream), &statbuf) < 0)
{
bfd_set_error (bfd_error_system_call);
--- 123,134 ----
char *secname;
flagword flags;
! /* Read coreoffsets region at end of core (see core(FP)). */
{
FILE *stream = bfd_cache_lookup (abfd);
struct stat statbuf;
!
if (fstat (fileno (stream), &statbuf) < 0)
{
bfd_set_error (bfd_error_system_call);
Index: bfd/trad-core.c
===================================================================
RCS file: /cvs/src/src/bfd/trad-core.c,v
retrieving revision 1.16
diff -c -3 -p -r1.16 trad-core.c
*** bfd/trad-core.c 15 Mar 2004 14:21:43 -0000 1.16
--- bfd/trad-core.c 5 May 2004 15:44:29 -0000
*************** trad_unix_core_file_p (abfd)
*** 111,118 ****
{
FILE *stream = bfd_cache_lookup (abfd);
struct stat statbuf;
! if (stream == NULL)
! return 0;
if (fstat (fileno (stream), &statbuf) < 0)
{
bfd_set_error (bfd_error_system_call);
--- 111,117 ----
{
FILE *stream = bfd_cache_lookup (abfd);
struct stat statbuf;
!
if (fstat (fileno (stream), &statbuf) < 0)
{
bfd_set_error (bfd_error_system_call);