Issue of the Implementation # S0590


Incorrect return value of FcAtomicLock

Detailed Description

The description of the function FcAtomicLock states: "Returns FcFalse if the file is locked by another process, else returns FcTrue and leaves the file locked.". So if we try to lock the file for the second time from the same process the function should return FcTrue.

However the implementation of the function FcAtomicLock returns FcFalse in this case.

Problem location(s) in the standard

Fontconfig Developers Reference, Version 2.4.2


#define FILE1 any_file //any existing file here
FcAtomic  *fca;
FcBool    b1, b2;

    if (!(fca = FcAtomicCreate ((FcChar8 *)FILE1)))
        printf ("Could not create FcAtomic\n");
    printf("Trying to lock the file %s\n", (char*)FILE1);
    b1 = FcAtomicLock (fca);
    b2 = FcAtomicLock (fca);  

     * b2 have to be FcTrue but it is FcFalse


fontconfig 2.2.3 or later

Accepted Bugzilla 12947


Fixed in fontconfig 2.5.0