2009-06-27 H.J. Lu <hongjiu.lu@intel.com>

PR binutils/10321
	* bucomm.c (get_file_size): Return -1 on error.

	* objcopy.c (copy_file): Report empty file.
This commit is contained in:
H.J. Lu 2009-06-27 17:19:02 +00:00
parent 83b89087cf
commit 52a476eeda
3 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2009-06-27 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/10321
* bucomm.c (get_file_size): Return -1 on error.
* objcopy.c (copy_file): Report empty file.
2009-06-23 Nick Clifton <nickc@redhat.com> 2009-06-23 Nick Clifton <nickc@redhat.com>
* dwarf.c (display_debug_lines_raw): Include the name of the * dwarf.c (display_debug_lines_raw): Include the name of the

View File

@ -571,7 +571,7 @@ get_file_size (const char * file_name)
else else
return statbuf.st_size; return statbuf.st_size;
return 0; return (off_t) -1;
} }
/* Return the filename in a static buffer. */ /* Return the filename in a static buffer. */

View File

@ -2159,9 +2159,13 @@ copy_file (const char *input_filename, const char *output_filename,
bfd *ibfd; bfd *ibfd;
char **obj_matching; char **obj_matching;
char **core_matching; char **core_matching;
off_t size = get_file_size (input_filename);
if (get_file_size (input_filename) < 1) if (size < 1)
{ {
if (size == 0)
non_fatal (_("error: the input file '%s' is empty"),
input_filename);
status = 1; status = 1;
return; return;
} }