commit:     fa5ae8d08656c784c41818b298aa9321458b15ce
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 13 08:48:03 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Jul 13 08:48:03 2015 +0000
URL:        https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=fa5ae8d0

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);

Reply via email to