]> git.wh0rd.org - fontconfig.git/commitdiff
Have fc-cache skip directories without write access
authorKeith Packard <keithp@keithp.com>
Wed, 12 Feb 2003 20:35:32 +0000 (20:35 +0000)
committerKeith Packard <keithp@keithp.com>
Wed, 12 Feb 2003 20:35:32 +0000 (20:35 +0000)
fc-cache/fc-cache.c

index c7485aad320c080e5c5e39785634cfbbf8a7f6e0..53eddbbff85517b6012c008db1b1fc24d55be6f1 100644 (file)
@@ -129,21 +129,33 @@ scanDirs (FcStrList *list, FcConfig *config, char *program, FcBool force, FcBool
            continue;
        }
        
-       if (stat ((char *) dir, &statb) == -1)
+       if (access ((char *) dir, W_OK) < 0)
        {
-           if (errno == ENOENT || errno == ENOTDIR)
-           {
+           switch (errno) {
+           case ENOENT:
+           case ENOTDIR:
                if (verbose)
-                   printf ("no such directory, skipping\n");
-           }
-           else
-           {
+                   printf ("skipping, no such directory\n");
+               break;
+           case EACCES:
+           case EROFS:
+               if (verbose)
+                   printf ("skipping, no write access\n");
+               break;
+           default:
                fprintf (stderr, "\"%s\": ", dir);
                perror ("");
                ret++;
            }
            continue;
        }
+       if (stat ((char *) dir, &statb) == -1)
+       {
+           fprintf (stderr, "\"%s\": ", dir);
+           perror ("");
+           ret++;
+           continue;
+       }
        if (!S_ISDIR (statb.st_mode))
        {
            fprintf (stderr, "\"%s\": not a directory, skipping\n", dir);