]> git.sur5r.net Git - openldap/commitdiff
ITS#8505 Protect parent from fork()-pthread_exit()
authorHallvard Furuseth <hallvard@openldap.org>
Tue, 27 Sep 2016 05:03:40 +0000 (07:03 +0200)
committerHallvard Furuseth <hallvard@openldap.org>
Tue, 4 Oct 2016 19:16:27 +0000 (21:16 +0200)
libraries/liblmdb/mdb.c

index 27582ae745e6129dc6cc918fd820eeec53772185..af365b3e25dcf062ccb527a5b1712c1d3765dc72 100644 (file)
@@ -4747,7 +4747,11 @@ mdb_env_reader_dest(void *ptr)
 {
        MDB_reader *reader = ptr;
 
-       reader->mr_pid = 0;
+#ifndef _WIN32
+       if (reader->mr_pid == getpid()) /* catch pthread_exit() in child process */
+#endif
+               /* We omit the mutex, so do this atomically (i.e. skip mr_txnid) */
+               reader->mr_pid = 0;
 }
 
 #ifdef _WIN32