From effee09f856ecc81feb91290459a2cda49d20287 Mon Sep 17 00:00:00 2001 From: jdp Date: Sun, 6 Sep 1998 22:57:45 +0000 Subject: Import GNU binutils-2.9.1. This will break things for a few minutes until I've made the commits to resolve the conflicts. Submitted by: Doug Rabson --- contrib/binutils/bfd/libbfd.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'contrib/binutils/bfd/libbfd.c') diff --git a/contrib/binutils/bfd/libbfd.c b/contrib/binutils/bfd/libbfd.c index 5c18a48..042bdee 100644 --- a/contrib/binutils/bfd/libbfd.c +++ b/contrib/binutils/bfd/libbfd.c @@ -1,5 +1,6 @@ /* Assorted BFD support routines, only used internally. - Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. + Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998 + Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -687,9 +688,20 @@ bfd_seek (abfd, position, direction) if (result != 0) { + int hold_errno = errno; + /* Force redetermination of `where' field. */ bfd_tell (abfd); - bfd_set_error (bfd_error_system_call); + + /* An EINVAL error probably means that the file offset was + absurd. */ + if (hold_errno == EINVAL) + bfd_set_error (bfd_error_file_truncated); + else + { + bfd_set_error (bfd_error_system_call); + errno = hold_errno; + } } else { -- cgit v1.1