]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
2005-08-07 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Mon, 8 Aug 2005 03:49:35 +0000 (03:49 +0000)
committerRoland McGrath <roland@redhat.com>
Mon, 8 Aug 2005 03:49:35 +0000 (03:49 +0000)
* strip.c (process_file): Open read-only when using a different output
file.

src/ChangeLog
src/strip.c

index a384ed6769ba8e82df4b23c8e02d8f076451f2c6..812290347560609bcc6d677efab6933e1341281c 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-07  Roland McGrath  <roland@redhat.com>
+
+       * strip.c (process_file): Open read-only when using a different output
+       file.
+
 2005-08-06  Ulrich Drepper  <drepper@redhat.com>
 
        * elflint.c (in_nobits_scn): New function.
index 214513c4dfd72522bf6b662662978383c3e81326..2de5d6b8c69d7de4401df101614d7a8f88c5e091 100644 (file)
@@ -274,7 +274,7 @@ process_file (const char *fname)
     }
 
   /* Open the file.  */
-  int fd = open (fname, O_RDWR);
+  int fd = open (fname, output_fname == NULL ? O_RDWR : O_RDONLY);
   if (fd == -1)
     {
       error (0, errno, gettext ("while opening \"%s\""), fname);
@@ -300,7 +300,8 @@ process_file (const char *fname)
     }
 
   /* Now get the ELF descriptor.  */
-  Elf *elf = elf_begin (fd, ELF_C_RDWR, NULL);
+  Elf *elf = elf_begin (fd, output_fname == NULL ? ELF_C_RDWR : ELF_C_READ,
+                       NULL);
   int result;
   switch (elf_kind (elf))
     {