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.
This commit is contained in:
Keith Packard 2007-10-18 05:04:39 -07:00
parent 2b0d3d8af5
commit 238489030a
2 changed files with 3 additions and 3 deletions

View File

@ -264,7 +264,7 @@ cleanCacheDirectory (FcConfig *config, FcChar8 *dir, FcBool verbose)
fprintf (stderr, "%s: out of memory\n", dir); fprintf (stderr, "%s: out of memory\n", dir);
return FcFalse; return FcFalse;
} }
if (access ((char *) dir, W_OK|X_OK) != 0) if (access ((char *) dir, W_OK) != 0)
{ {
if (verbose) if (verbose)
printf ("%s: not cleaning %s cache directory\n", dir, printf ("%s: not cleaning %s cache directory\n", dir,

View File

@ -727,7 +727,7 @@ FcMakeDirectory (const FcChar8 *dir)
parent = FcStrDirname (dir); parent = FcStrDirname (dir);
if (!parent) if (!parent)
return FcFalse; return FcFalse;
if (access ((char *) parent, W_OK|X_OK) == 0) if (access ((char *) parent, F_OK) == 0)
ret = mkdir ((char *) dir, 0777) == 0; ret = mkdir ((char *) dir, 0777) == 0;
else if (access ((char *) parent, F_OK) == -1) else if (access ((char *) parent, F_OK) == -1)
ret = FcMakeDirectory (parent) && (mkdir ((char *) dir, 0777) == 0); ret = FcMakeDirectory (parent) && (mkdir ((char *) dir, 0777) == 0);
@ -760,7 +760,7 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config)
if (!list) if (!list)
return FcFalse; return FcFalse;
while ((test_dir = FcStrListNext (list))) { 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; cache_dir = test_dir;
break; break;