tar: make remove(3) non-fatal when extracting

Handles special cases like: .
This commit is contained in:
Eivind Uggedal 2016-02-15 14:00:00 +00:00 committed by sin
parent e13f571d11
commit ae52820891

2
tar.c
View File

@ -259,7 +259,7 @@ unarchive(char *fname, ssize_t l, char b[BLKSIZ])
if (!mflag && ((mtime = strtol(h->mtime, &p, 8)) < 0 || *p != '\0'))
eprintf("strtol %s: invalid number\n", h->mtime);
if (remove(fname) < 0 && errno != ENOENT)
eprintf("remove %s:", fname);
weprintf("remove %s:", fname);
tmp = estrdup(fname);
mkdirp(dirname(tmp));