about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-02-24 12:33:06 -0500
committerRich Felker <dalias@aerifal.cx>2018-02-24 12:33:06 -0500
commit455bd824457b3e6cc3998817aac4e500b027cc50 (patch)
treeb116a97d30a0b0c84e2dd9fa1a59bdeb475bf67d /src
parent7c59d098632e4382c9b674b189edbfd80d327682 (diff)
downloadmusl-455bd824457b3e6cc3998817aac4e500b027cc50.tar.gz
musl-455bd824457b3e6cc3998817aac4e500b027cc50.tar.xz
musl-455bd824457b3e6cc3998817aac4e500b027cc50.zip
use idiomatic safe form for FUNLOCK macro
previously this macro used an odd if/else form instead of the more
idiomatic do/while(0), making it unsafe against omission of trailing
semicolon. the omission would make the following statement conditional
instead of producing an error.
Diffstat (limited to 'src')
-rw-r--r--src/internal/stdio_impl.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/internal/stdio_impl.h b/src/internal/stdio_impl.h
index 7cdf729d..1127a492 100644
--- a/src/internal/stdio_impl.h
+++ b/src/internal/stdio_impl.h
@@ -9,7 +9,7 @@
 
 #define FFINALLOCK(f) ((f)->lock>=0 ? __lockfile((f)) : 0)
 #define FLOCK(f) int __need_unlock = ((f)->lock>=0 ? __lockfile((f)) : 0)
-#define FUNLOCK(f) if (__need_unlock) __unlockfile((f)); else
+#define FUNLOCK(f) do { if (__need_unlock) __unlockfile((f)); } while (0)
 
 #define F_PERM 1
 #define F_NORD 4