aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/1002-check-lockcount-in-funlockfile.patch
blob: a2ae3a13606e412dae43b6fa71715d68d4da4bd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff -ru musl-1.1.4.orig/src/stdio/funlockfile.c musl-1.1.4/src/stdio/funlockfile.c
--- musl-1.1.4.orig/src/stdio/funlockfile.c	2014-09-05 11:58:04.928864395 -0300
+++ musl-1.1.4/src/stdio/funlockfile.c	2014-09-05 11:58:45.915533166 -0300
@@ -1,10 +1,12 @@
 #include "stdio_impl.h"
 #include "pthread_impl.h"
+#include "atomic.h"
 
 void __unlist_locked_file(FILE *);
 
 void funlockfile(FILE *f)
 {
+	if (f->lockcount == 0) a_crash();
 	if (f->lockcount == 1) {
 		__unlist_locked_file(f);
 		f->lockcount = 0;