fontconfig: Branch 'master'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 src/fcatomic.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 26160366d7ba5c7baf20ae091d5dd0388714df83
Author: Akira TAGOH <akira@xxxxxxxxx>
Date:   Mon May 28 15:58:56 2012 +0900

    fcatomic: fallback to create a directory with FcAtomicLock
    
    link(2) might be failed on the filesystem that doesn't support
    the hard link. e.g. FcAtomicLock() always fails on FAT filesystem
    when link(2) is available.
    So that may be a good idea to fallback if link(2) is failed.

diff --git a/src/fcatomic.c b/src/fcatomic.c
index 33c1cc6..4f6ab01 100644
--- a/src/fcatomic.c
+++ b/src/fcatomic.c
@@ -130,6 +130,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);
@@ -195,7 +202,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
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig


[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux