about summary refs log tree commit diff
path: root/stdio-common
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/ftrylockfile.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/stdio-common/ftrylockfile.c b/stdio-common/ftrylockfile.c
index 4f7e2dd617..f7e2ef6137 100644
--- a/stdio-common/ftrylockfile.c
+++ b/stdio-common/ftrylockfile.c
@@ -17,14 +17,13 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <stdio.h>
-
-#undef _IO_ftrylockfile
+#include <stdio-lock.h>
+#include <sys/single_threaded.h>
 
 int
 __ftrylockfile (FILE *stream)
 {
-  /* Do nothing.  Using this version does not do any locking.  */
-  return 1;
+  return _IO_lock_trylock (*stream->_lock);
 }
 weak_alias (__ftrylockfile, ftrylockfile);
 weak_alias (__ftrylockfile, _IO_ftrylockfile)