sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit fb1595a69c091a6f6a9303b1fab19360b876d114
parent 3419f94d8310a916a90e26c14a6aedcd0faca4e3
Author: sin <sin@2f30.org>
Date:   Thu, 23 Apr 2015 14:05:43 +0100

tar: Use remove() instead of unlink() so we can work on directories too

Diffstat:
Mtar.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tar.c b/tar.c @@ -201,7 +201,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 (unlink(fname) < 0 && errno != ENOENT && errno != EISDIR) + if (remove(fname) < 0 && errno != ENOENT) eprintf("unlink %s:", fname); tmp = estrdup(fname);