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.
This commit is contained in:
parent
ce145a39a7
commit
542f645bc2
2
tar.c
2
tar.c
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user