From: Hallvard Furuseth Date: Tue, 27 Sep 2016 05:03:40 +0000 (+0200) Subject: ITS#8505 Protect parent from fork()-pthread_exit() X-Git-Tag: LMDB_0.9.19~13 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6e81d4071b441840fc09855643f35ea992784002;p=openldap ITS#8505 Protect parent from fork()-pthread_exit() --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 36094bf4f3..e2f1bbca1d 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -4429,7 +4429,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