Skip to content
Snippets Groups Projects
Commit b677b8c0 authored by Alan Modra's avatar Alan Modra
Browse files

* hppabsd-core.c (hppabsd_core_core_file_p): Use bfd_stat, not fstat.

	* sco5-core.c (sco5_core_file_p): Likewise.
	* trad-core.c (trad_unix_core_file_p): Likewise.
parent d0fdd288
No related branches found
No related tags found
No related merge requests found
2005-10-27 Alan Modra <amodra@bigpond.net.au> 2005-10-27 Alan Modra <amodra@bigpond.net.au>
* hppabsd-core.c (hppabsd_core_core_file_p): Use bfd_stat, not fstat.
* sco5-core.c (sco5_core_file_p): Likewise.
* trad-core.c (trad_unix_core_file_p): Likewise.
* cache.c: Reorganize file to avoid forward reference. * cache.c: Reorganize file to avoid forward reference.
2005-10-26 Alan Modra <amodra@bigpond.net.au> 2005-10-26 Alan Modra <amodra@bigpond.net.au>
......
/* BFD back-end for HPPA BSD core files. /* BFD back-end for HPPA BSD core files.
Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004 Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
...@@ -137,16 +137,11 @@ hppabsd_core_core_file_p (abfd) ...@@ -137,16 +137,11 @@ hppabsd_core_core_file_p (abfd)
/* Sanity checks. Make sure the size of the core file matches the /* Sanity checks. Make sure the size of the core file matches the
the size computed from information within the core itself. */ the size computed from information within the core itself. */
{ {
FILE *stream = bfd_cache_lookup (abfd);
struct stat statbuf; struct stat statbuf;
if (stream == NULL) if (bfd_stat (abfd, &statbuf) < 0)
return NULL; return NULL;
if (fstat (fileno (stream), &statbuf) < 0)
{
bfd_set_error (bfd_error_system_call);
return NULL;
}
if (NBPG * (UPAGES + u.u_dsize + u.u_ssize) > statbuf.st_size) if (NBPG * (UPAGES + u.u_dsize + u.u_ssize) > statbuf.st_size)
{ {
bfd_set_error (bfd_error_file_truncated); bfd_set_error (bfd_error_file_truncated);
......
/* BFD back end for SCO5 core files (U-area and raw sections) /* BFD back end for SCO5 core files (U-area and raw sections)
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by Jouke Numan <jnuman@hiscom.nl> Written by Jouke Numan <jnuman@hiscom.nl>
...@@ -126,16 +126,11 @@ sco5_core_file_p (abfd) ...@@ -126,16 +126,11 @@ sco5_core_file_p (abfd)
/* Read coreoffsets region at end of core (see core(FP)). */ /* Read coreoffsets region at end of core (see core(FP)). */
{ {
FILE *stream = bfd_cache_lookup (abfd);
struct stat statbuf; struct stat statbuf;
if (stream == NULL) if (bfd_stat (abfd, &statbuf) < 0)
return NULL; return NULL;
if (fstat (fileno (stream), &statbuf) < 0)
{
bfd_set_error (bfd_error_system_call);
return NULL;
}
coresize = statbuf.st_size; coresize = statbuf.st_size;
} }
/* Last long in core is sizeof struct coreoffsets, read it */ /* Last long in core is sizeof struct coreoffsets, read it */
......
/* BFD back end for traditional Unix core files (U-area and raw sections) /* BFD back end for traditional Unix core files (U-area and raw sections)
Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
2000, 2001, 2002, 2003, 2004 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by John Gilmore of Cygnus Support. Written by John Gilmore of Cygnus Support.
...@@ -109,16 +109,11 @@ trad_unix_core_file_p (abfd) ...@@ -109,16 +109,11 @@ trad_unix_core_file_p (abfd)
/* Check that the size claimed is no greater than the file size. */ /* Check that the size claimed is no greater than the file size. */
{ {
FILE *stream = bfd_cache_lookup (abfd);
struct stat statbuf; struct stat statbuf;
if (stream == NULL) if (bfd_stat (abfd, &statbuf) < 0)
return 0; return 0;
if (fstat (fileno (stream), &statbuf) < 0)
{
bfd_set_error (bfd_error_system_call);
return 0;
}
if ((unsigned long) (NBPG * (UPAGES + u.u_dsize if ((unsigned long) (NBPG * (UPAGES + u.u_dsize
#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE #ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
- u.u_tsize - u.u_tsize
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment