From f0ab396036210188e5086426c0d8ca096aafe61c Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 3 Aug 2012 10:58:16 +0200 Subject: [PATCH] xbps-{bin,repo}: ignore ENOENT when checking write perms in {root,meta,cache}dir. --- bin/xbps-bin/main.c | 12 +++++++----- bin/xbps-repo/main.c | 10 ++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/bin/xbps-bin/main.c b/bin/xbps-bin/main.c index d3ad11aa..149de117 100644 --- a/bin/xbps-bin/main.c +++ b/bin/xbps-bin/main.c @@ -243,11 +243,13 @@ main(int argc, char **argv) if ((access(xh.rootdir, W_OK) == -1) || (access(xh.metadir, W_OK) == -1) || (access(xh.cachedir, W_OK) == -1)) { - xbps_error_printf("xbps-bin: cannot write to " - "rootdir/cachedir/metadir: %s\n", - strerror(errno)); - xbps_end(&xh); - exit(EXIT_FAILURE); + if (errno != ENOENT) { + xbps_error_printf("xbps-bin: cannot write to " + "rootdir/cachedir/metadir: %s\n", + strerror(errno)); + xbps_end(&xh); + exit(EXIT_FAILURE); + } } } diff --git a/bin/xbps-repo/main.c b/bin/xbps-repo/main.c index c2b1713e..85712333 100644 --- a/bin/xbps-repo/main.c +++ b/bin/xbps-repo/main.c @@ -158,10 +158,12 @@ main(int argc, char **argv) (strcasecmp(argv[0], "clean") == 0)) { if ((access(xh.metadir, W_OK) == -1) || (access(xh.cachedir, W_OK) == -1)) { - xbps_error_printf("xbps-repo: cannot write to " - "cachedir/metadir: %s\n", strerror(errno)); - xbps_end(&xh); - exit(EXIT_FAILURE); + if (errno != ENOENT) { + xbps_error_printf("xbps-repo: cannot write to " + "cachedir/metadir: %s\n", strerror(errno)); + xbps_end(&xh); + exit(EXIT_FAILURE); + } } }