[hackers] [sbase] tar: Use remove() instead of unlink() so we can work on directories too || sin

From: <git_AT_suckless.org>
Date: Thu, 23 Apr 2015 16:32:06 +0200 (CEST)

commit fb1595a69c091a6f6a9303b1fab19360b876d114
Author: sin <sin_AT_2f30.org>
Date: Thu Apr 23 14:05:43 2015 +0100

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

diff --git a/tar.c b/tar.c
index 6a6595a..c906f0f 100644
--- a/tar.c
+++ b/tar.c
_AT_@ -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);
Received on Thu Apr 23 2015 - 16:32:06 CEST

This archive was generated by hypermail 2.3.0 : Thu Apr 23 2015 - 16:36:12 CEST