This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR binutils/10364: strip doesn't fail on unwriteable files


Hi,

objcopy failed to check retuns from smart_rename.  I checked in this
patch as an obvious fix.

Thanks.


H.J.
---
Index: objcopy.c
===================================================================
--- objcopy.c	(revision 6507)
+++ objcopy.c	(working copy)
@@ -3014,9 +3014,11 @@ strip_main (int argc, char *argv[])
 	  if (preserve_dates)
 	    set_times (tmpname, &statbuf);
 	  if (output_file != tmpname)
-	    smart_rename (tmpname, output_file ? output_file : argv[i],
-			  preserve_dates);
-	  status = hold_status;
+	    status = (smart_rename (tmpname,
+				    output_file ? output_file : argv[i],
+				    preserve_dates) != 0);
+	  if (status == 0)
+	    status = hold_status;
 	}
       else
 	unlink_if_ordinary (tmpname);
@@ -3866,7 +3868,8 @@ copy_main (int argc, char *argv[])
       if (preserve_dates)
 	set_times (tmpname, &statbuf);
       if (tmpname != output_filename)
-	smart_rename (tmpname, input_filename, preserve_dates);
+	status = (smart_rename (tmpname, input_filename,
+				preserve_dates) != 0);
     }
   else
     unlink_if_ordinary (tmpname);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 6507)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2009-08-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR binutils/10364
+	* objcopy.c (strip_main): Check return from smart_rename.
+	(copy_main): Likewise.
+
 2009-07-27  Nick Clifton  <nickc@redhat.com>
 
 	PR 10413


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]