diff options
author | Akira TAGOH <akira@tagoh.org> | 2018-10-01 07:01:26 +0000 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2018-10-05 02:32:09 +0000 |
commit | 5f5ec5676c61b9773026a9335c9b0dfa73a73353 (patch) | |
tree | 39d82ce220f6a041cb834575f98f7e6ed3030c85 /src/fccache.c | |
parent | ff5b49be2be0922f0fb6b9daf08f64a88d2fae6b (diff) | |
download | fontconfig-5f5ec5676c61b9773026a9335c9b0dfa73a73353.tar.gz |
Do not try updating mtime when unlink was failed
Diffstat (limited to 'src/fccache.c')
-rw-r--r-- | src/fccache.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/fccache.c b/src/fccache.c index a5e0ea3..87073ba 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -171,20 +171,23 @@ FcDirCacheDeleteUUID (const FcChar8 *dir, } target = FcStrBuildFilename (d, ".uuid", NULL); ret = unlink ((char *) target) == 0; - times[0].tv_sec = statb.st_atime; - times[1].tv_sec = statb.st_mtime; + if (ret) + { + times[0].tv_sec = statb.st_atime; + times[1].tv_sec = statb.st_mtime; #ifdef HAVE_STRUCT_STAT_ST_MTIM - times[0].tv_usec = statb.st_atim.tv_nsec / 1000; - times[1].tv_usec = statb.st_mtim.tv_nsec / 1000; + times[0].tv_usec = statb.st_atim.tv_nsec / 1000; + times[1].tv_usec = statb.st_mtim.tv_nsec / 1000; #else - times[0].tv_usec = 0; - times[1].tv_usec = 0; + times[0].tv_usec = 0; + times[1].tv_usec = 0; #endif - if (utimes ((const char *) d, times) != 0) - { - fprintf (stderr, "Unable to revert mtime: %s\n", d); + if (utimes ((const char *) d, times) != 0) + { + fprintf (stderr, "Unable to revert mtime: %s\n", d); + } + FcHashTableRemove (config->uuid_table, target); } - FcHashTableRemove (config->uuid_table, target); FcStrFree (target); bail: FcStrFree (d); |