support archs with no renameat syscall, only renameat2
[musl] / src / stdio / flockfile.c
index 440a36a..8e22065 100644 (file)
@@ -3,9 +3,7 @@
 
 void flockfile(FILE *f)
 {
-       if (!libc.lockfile) {
-               pthread_self();
-               libc.lockfile = __lockfile;
-       }
+       if (!ftrylockfile(f)) return;
        __lockfile(f);
+       __register_locked_file(f, __pthread_self());
 }