]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
elflint, readelf: enhance error diagnostics
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 30 Sep 2019 11:39:50 +0000 (14:39 +0300)
committerMark Wielaard <mark@klomp.org>
Fri, 4 Oct 2019 07:55:21 +0000 (09:55 +0200)
When an input file cannot be opened, include its name
into the error diagnostics.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
src/ChangeLog
src/elflint.c
src/readelf.c

index 3007c30d9d17f62d0bd6b040871862b79993bb02..db56a136c0b7fe09cc5c5c500c5a24b9216c4d5b 100644 (file)
@@ -1,3 +1,9 @@
+2019-09-28  Dmitry V. Levin  <ldv@altlinux.org>
+
+       * elflint.c (main): When an input file cannot be opened,
+       include its name into the error diagnostics.
+       * readelf.c (main): Likewise.
+
 2019-09-02  Mark Wielaard  <mark@klomp.org>
 
        * readelf.c (PRINT_DYNSYM_TABLE): New argp key value.
index edb466dd608451ed3b1aed2450d605171faf75fe..684b794e341376322fd17615ce2b145b9b82f303 100644 (file)
@@ -151,15 +151,15 @@ main (int argc, char *argv[])
       int fd = open (argv[remaining], O_RDONLY);
       if (fd == -1)
        {
-         error (0, errno, gettext ("cannot open input file"));
+         error (0, errno, _("cannot open input file '%s'"), argv[remaining]);
          continue;
        }
 
       /* Create an `Elf' descriptor.  */
       Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL);
       if (elf == NULL)
-       ERROR (gettext ("cannot generate Elf descriptor: %s\n"),
-              elf_errmsg (-1));
+       ERROR (_("cannot generate Elf descriptor for '%s': %s\n"),
+              argv[remaining], elf_errmsg (-1));
       else
        {
          unsigned int prev_error_count = error_count;
index 5d2b5f43895c8a6f390f3416608dae32858eefef..cbb519d1890df9f71f271059bcf701f216debacd 100644 (file)
@@ -365,7 +365,7 @@ main (int argc, char *argv[])
       int fd = open (argv[remaining], O_RDONLY);
       if (fd == -1)
        {
-         error (0, errno, gettext ("cannot open input file"));
+         error (0, errno, _("cannot open input file '%s'"), argv[remaining]);
          continue;
        }