summaryrefslogtreecommitdiff
path: root/src/fccache.c
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2018-06-11 17:03:17 +0900
committerAkira TAGOH <akira@tagoh.org>2018-06-11 17:03:46 +0900
commitf5dd8512bdf9fd8e01c30ae36f593758b29385cf (patch)
tree0ad5f8e2ccd3151ab317be1a9d85320f9f0268c2 /src/fccache.c
parent096e8019be595c2224aaabf98da630ee917ee51c (diff)
downloadfontconfig-f5dd8512bdf9fd8e01c30ae36f593758b29385cf.tar.gz
Remove .uuid when no font files exists on a directory
https://bugs.freedesktop.org/show_bug.cgi?id=106632
Diffstat (limited to 'src/fccache.c')
-rw-r--r--src/fccache.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/fccache.c b/src/fccache.c
index 667d4e7..ada91d1 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -109,6 +109,7 @@ FcDirCacheCreateUUID (FcChar8 *dir,
if (!hash_add (config->uuid_table, target, uuid))
{
ret = FcFalse;
+ FcAtomicDeleteNew (atomic);
goto bail3;
}
uuid_unparse (uuid, out);
@@ -148,6 +149,26 @@ bail1:
return ret;
}
+FcBool
+FcDirCacheDeleteUUID (const FcChar8 *dir,
+ FcConfig *config)
+{
+ const FcChar8 *sysroot = FcConfigGetSysRoot (config);
+ FcChar8 *target;
+ FcBool ret = FcTrue;
+
+ if (sysroot)
+ target = FcStrBuildFilename (sysroot, dir, ".uuid", NULL);
+ else
+ target = FcStrBuildFilename (dir, ".uuid", NULL);
+
+ ret = unlink ((char *) target) == 0;
+ FcStrFree (target);
+ FcHashTableRemove (config->uuid_table, target);
+
+ return ret;
+}
+
#ifndef _WIN32
static void
FcDirCacheReadUUID (FcChar8 *dir,
@@ -325,6 +346,7 @@ FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config)
if (!cache_hashed)
break;
(void) unlink ((char *) cache_hashed);
+ FcDirCacheDeleteUUID (dir, config);
FcStrFree (cache_hashed);
}
FcStrListDone (list);