From fa5ae8d08656c784c41818b298aa9321458b15ce Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 13 Jul 2015 04:48:03 -0400 Subject: scanelf: include filename/details in all ar related messages When scanelf runs on a directory tree, it might issue an error message about invalid data because of one of the files in there. Trying to then track down that file is kind of a pain, so make things more explicit. --- paxinc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/paxinc.c b/paxinc.c index b9a196b..f2ce3c5 100644 --- a/paxinc.c +++ b/paxinc.c @@ -40,7 +40,7 @@ archive_handle *ar_open(const char *filename) archive_handle *ret; if ((fd=open(filename, O_RDONLY)) == -1) - err("Could not open '%s'", filename); + errp("%s: could not open", filename); ret = ar_open_fd(filename, fd); if (ret == NULL) @@ -76,13 +76,13 @@ close_and_ret: } if ((ret.buf.formatted.magic[0] != '`') || (ret.buf.formatted.magic[1] != '\n')) { - warn("Invalid ar entry"); + warn("%s: invalid ar entry", ar->filename); goto close_and_ret; } if (ret.buf.formatted.name[0] == '/' && ret.buf.formatted.name[1] == '/') { if (ar->extfn != NULL) { - warn("Duplicate GNU extended filename section"); + warn("%s: Duplicate GNU extended filename section", ar->filename); goto close_and_ret; } len = atoi(ret.buf.formatted.size); @@ -112,7 +112,7 @@ close_and_ret: } else if (s[0] == '/' && s[1] >= '0' && s[1] <= '9') { /* GNU extended filename */ if (ar->extfn == NULL) { - warn("GNU extended filename without special data section"); + warn("%s: GNU extended filename without special data section", ar->filename); goto close_and_ret; } s = ar->extfn + atoi(s + 1); -- cgit v1.2.3-65-gdbad