From 15d7bd0a16af189194b665e789331a8f8c86f20d Mon Sep 17 00:00:00 2001 From: Patrick Lam Date: Fri, 14 Oct 2005 20:56:27 +0000 Subject: [PATCH] Check existence of directory cache file before attempting to unlink. reviewed by: plam --- ChangeLog | 7 +++++++ src/fccache.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2ccc120..bd2585e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-10-14 Mike Fabian + reviewed by: plam + + * src/fccache.c (FcDirCacheUnlink): + + Check existence of directory cache file before attempting to unlink. + 2005-10-13 Patrick Lam * src/fccache.c (FcDirCacheUnlink): diff --git a/src/fccache.c b/src/fccache.c index 7ccb529..0bbfffe 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -573,8 +573,10 @@ FcBool FcDirCacheUnlink (const FcChar8 *dir) { FcChar8 *cache_file = FcStrPlus (dir, (FcChar8 *) "/" FC_DIR_CACHE_FILE); + struct stat cache_stat; - if (unlink ((char *)cache_file) != 0) + if (stat ((char *) cache_file, &cache_stat) == 0 && + unlink ((char *)cache_file) != 0) { FcStrFree (cache_file); return FcFalse; -- 2.39.5