[hackers] [sbase] [PATCH] tar: Fix error message reporting the wrong filename

From: Thomas Oltmann <thomas.oltmann.hhg_AT_gmail.com>
Date: Thu, 26 Nov 2020 12:50:53 +0100

In case utimensat() fails, we want to report the file
that produced the error, not the last file we extracted.

---
 tar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tar.c b/tar.c
index b74c134..77b94ff 100644
--- a/tar.c
+++ b/tar.c
_AT_@ -494,7 +494,7 @@ xt(int argc, char *argv[], int mode)
             times[0].tv_sec = times[1].tv_sec = dirtime->mtime;
             times[0].tv_nsec = times[1].tv_nsec = 0;
             if (utimensat(AT_FDCWD, dirtime->name, times, 0) < 0)
-                eprintf("utimensat %s:", fname);
+                eprintf("utimensat %s:", dirtime->name);
             free(dirtime->name);
         }
         free(dirtimes);
-- 
2.28.0
Received on Thu Nov 26 2020 - 12:50:53 CET

This archive was generated by hypermail 2.3.0 : Thu Nov 26 2020 - 20:24:31 CET