2009-06-27 H.J. Lu <hongjiu.lu@intel.com>
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 27 Jun 2009 17:19:02 +0000 (17:19 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 27 Jun 2009 17:19:02 +0000 (17:19 +0000)
PR binutils/10321
* bucomm.c (get_file_size): Return -1 on error.

* objcopy.c (copy_file): Report empty file.

binutils/ChangeLog
binutils/bucomm.c
binutils/objcopy.c

index c748a6a77ee6502738fb640df0fb88dbd91d9f36..0ff041fce02f6c032c4dad44dd98dec9a15a688b 100644 (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>
 
        * dwarf.c (display_debug_lines_raw): Include the name of the
index 9bbdafb9061b6ac159802710d41047af6966c5d4..c6786790a72bba9b18490e2ae697950658f0ad11 100644 (file)
@@ -571,7 +571,7 @@ get_file_size (const char * file_name)
   else
     return statbuf.st_size;
 
-  return 0;
+  return (off_t) -1;
 }
 
 /* Return the filename in a static buffer.  */
index 83d9e1b2aace81bc1e76e13bd601339f6b388baf..8908b564e1311e6266274fea5db0dd9588fd68ef 100644 (file)
@@ -2159,9 +2159,13 @@ copy_file (const char *input_filename, const char *output_filename,
   bfd *ibfd;
   char **obj_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;
       return;
     }
This page took 0.029772 seconds and 4 git commands to generate.