ar: Fix a return value check.
authorRoland McGrath <roland@hack.frob.com>
Sun, 6 Nov 2011 03:58:14 +0000 (20:58 -0700)
committerRoland McGrath <roland@hack.frob.com>
Sun, 6 Nov 2011 03:58:14 +0000 (20:58 -0700)
src/ChangeLog
src/ar.c

index 2334693..d777ca1 100644 (file)
@@ -1,3 +1,7 @@
+2011-11-05  Roland McGrath  <roland@hack.frob.com>
+
+       * ar.c (do_oper_insert): Fix check on elf_rawfile return value.
+
 2011-10-04  Marek Polacek  <mpolacek@redhat.com>
 
        * readelf.c (register_info): Assume the right size of an array.
index bfb324c..37d56b6 100644 (file)
--- a/src/ar.c
+++ b/src/ar.c
@@ -1302,7 +1302,8 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc,
              found[cnt]->name = bname;
 
              found[cnt]->mem = elf_rawfile (newelf, &found[cnt]->size);
-             if (found[cnt] == NULL || elf_cntl (newelf, ELF_C_FDDONE) != 0)
+             if (found[cnt]->mem == NULL
+                 || elf_cntl (newelf, ELF_C_FDDONE) != 0)
                error (EXIT_FAILURE, 0, gettext ("cannot read %s: %s"),
                       argv[cnt], elf_errmsg (-1));