about summary refs log tree commit diff
path: root/sysdeps/generic
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/stdio-lock.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/sysdeps/generic/stdio-lock.h b/sysdeps/generic/stdio-lock.h
index 38f93efce9..5f232f99a9 100644
--- a/sysdeps/generic/stdio-lock.h
+++ b/sysdeps/generic/stdio-lock.h
@@ -45,13 +45,26 @@ __libc_lock_define_recursive (typedef, _IO_lock_t)
   __libc_cleanup_region_end (_doit)
 
 #if defined _LIBC && IS_IN (libc)
+
+# ifdef __EXCEPTIONS
 # define _IO_acquire_lock(_fp) \
-  _IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, (_fp));      \
-  _IO_flockfile (_fp)
+  do {									      \
+    _IO_FILE *_IO_acquire_lock_file					      \
+	__attribute__((cleanup (_IO_acquire_lock_fct)))			      \
+	= (_fp);							      \
+    _IO_flockfile (_IO_acquire_lock_file);
+#  define _IO_acquire_lock_clear_flags2(_fp) \
+  do {									      \
+    _IO_FILE *_IO_acquire_lock_file					      \
+	__attribute__((cleanup (_IO_acquire_lock_clear_flags2_fct)))	      \
+	= (_fp);							      \
+    _IO_flockfile (_IO_acquire_lock_file);
+# else
+#  define _IO_acquire_lock(_fp) _IO_acquire_lock_needs_exceptions_enabled
+#  define _IO_acquire_lock_clear_flags2(_fp) _IO_acquire_lock (_fp)
+# endif
+# define _IO_release_lock(_fp) ; } while (0)
 
-# define _IO_release_lock(_fp) \
-  _IO_funlockfile (_fp);						      \
-  _IO_cleanup_region_end (0)
 #endif
 
 #endif /* stdio-lock.h */