[hackers] [sbase] Convert chown() failure to a warning in tar(1) || sin

From: <git_AT_suckless.org>
Date: Tue, 21 Apr 2015 10:17:30 +0200 (CEST)

commit 542f645bc226bca275a852afa24dc48f73074ca0
Author: sin <sin_AT_2f30.org>
Date: Tue Apr 21 09:15:13 2015 +0100

    Convert chown() failure to a warning in tar(1)
    
    This particular change does not have any immediate shortcomings.
    We still print a warning to alert the user.
    
    Exiting on a chown() failure caused problems when untarring
    inside a restricted user namespace on Linux where the uid/gid
    mappings were limited.

diff --git a/tar.c b/tar.c
index 06fb654..573dbdb 100644
--- a/tar.c
+++ b/tar.c
_AT_@ -242,7 +242,7 @@ unarchive(char *fname, ssize_t l, char b[BLKSIZ])
         if ((gid = strtol(h->gid, &p, 8)) < 0 || *p != '\0')
                 eprintf("strtol %s: invalid number\n", h->gid);
         if (!getuid() && chown(fname, uid, gid))
- eprintf("chown %s:", fname);
+ weprintf("chown %s:", fname);
 
         for (; l > 0; l -= BLKSIZ) {
                 if (fread(b, BLKSIZ, 1, tarfile) != 1)
Received on Tue Apr 21 2015 - 10:17:30 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 21 2015 - 10:24:10 CEST