From: Keith Packard Date: Thu, 18 Oct 2007 12:04:39 +0000 (-0700) Subject: Don't use X_OK bit when checking for writable directories (bug 12438) X-Git-Tag: 2.4.91~29 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=238489030a64fa883f8f9fc3d73247b7f7257899;p=fontconfig.git Don't use X_OK bit when checking for writable directories (bug 12438) Some mingw versions have broken X_OK checking; instead of trying to work around this in a system-depedent manner, simply don't bother checking for X_OK along with W_OK as such cases are expected to be mistakes, and not sensible access control. --- diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c index 531e8fb..dda40c1 100644 --- a/fc-cache/fc-cache.c +++ b/fc-cache/fc-cache.c @@ -264,7 +264,7 @@ cleanCacheDirectory (FcConfig *config, FcChar8 *dir, FcBool verbose) fprintf (stderr, "%s: out of memory\n", dir); return FcFalse; } - if (access ((char *) dir, W_OK|X_OK) != 0) + if (access ((char *) dir, W_OK) != 0) { if (verbose) printf ("%s: not cleaning %s cache directory\n", dir, diff --git a/src/fccache.c b/src/fccache.c index a6b532f..c43609c 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -727,7 +727,7 @@ FcMakeDirectory (const FcChar8 *dir) parent = FcStrDirname (dir); if (!parent) return FcFalse; - if (access ((char *) parent, W_OK|X_OK) == 0) + if (access ((char *) parent, F_OK) == 0) ret = mkdir ((char *) dir, 0777) == 0; else if (access ((char *) parent, F_OK) == -1) ret = FcMakeDirectory (parent) && (mkdir ((char *) dir, 0777) == 0); @@ -760,7 +760,7 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config) if (!list) return FcFalse; while ((test_dir = FcStrListNext (list))) { - if (access ((char *) test_dir, W_OK|X_OK) == 0) + if (access ((char *) test_dir, W_OK) == 0) { cache_dir = test_dir; break;