* [PATCH] elflint, readelf: enhance error diagnostics
@ 2019-09-30 11:39 Dmitry V. Levin
2019-10-04 7:57 ` Mark Wielaard
0 siblings, 1 reply; 2+ messages in thread
From: Dmitry V. Levin @ 2019-09-30 11:39 UTC (permalink / raw)
To: elfutils-devel
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 | 6 ++++++
src/elflint.c | 6 +++---
src/readelf.c | 2 +-
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 3007c30d..db56a136 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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.
diff --git a/src/elflint.c b/src/elflint.c
index edb466dd..684b794e 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -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;
diff --git a/src/readelf.c b/src/readelf.c
index 5d2b5f43..cbb519d1 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -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;
}
--
ldv
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] elflint, readelf: enhance error diagnostics
2019-09-30 11:39 [PATCH] elflint, readelf: enhance error diagnostics Dmitry V. Levin
@ 2019-10-04 7:57 ` Mark Wielaard
0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2019-10-04 7:57 UTC (permalink / raw)
To: Dmitry V. Levin; +Cc: elfutils-devel
On Mon, Sep 30, 2019 at 02:39:50PM +0300, Dmitry V. Levin wrote:
> When an input file cannot be opened, include its name
> into the error diagnostics.
Looks very sensible. Pushed to master.
Thanks,
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-04 7:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-30 11:39 [PATCH] elflint, readelf: enhance error diagnostics Dmitry V. Levin
2019-10-04 7:57 ` Mark Wielaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).