diff options
Diffstat (limited to 'fontconfig/src/fcatomic.c')
-rw-r--r-- | fontconfig/src/fcatomic.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fontconfig/src/fcatomic.c b/fontconfig/src/fcatomic.c index b5f3d5aaa..96f01235f 100644 --- a/fontconfig/src/fcatomic.c +++ b/fontconfig/src/fcatomic.c @@ -131,6 +131,13 @@ FcAtomicLock (FcAtomic *atomic) return FcFalse; } ret = link ((char *) atomic->tmp, (char *) atomic->lck); + if (ret < 0 && errno == EPERM) + { + /* the filesystem where atomic->lck points to may not supports + * the hard link. so better try to fallback + */ + ret = mkdir ((char *) atomic->lck, 0600); + } (void) unlink ((char *) atomic->tmp); #else ret = mkdir ((char *) atomic->lck, 0600); @@ -196,7 +203,8 @@ void FcAtomicUnlock (FcAtomic *atomic) { #ifdef HAVE_LINK - unlink ((char *) atomic->lck); + if (unlink ((char *) atomic->lck) == -1) + rmdir ((char *) atomic->lck); #else rmdir ((char *) atomic->lck); #endif |