diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2016-12-13 09:00:20 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2016-12-13 09:18:46 +0200 |
commit | 9b9e998c9afe33a5e2552ec03d33e13a22215394 (patch) | |
tree | eae682b32d1c3b2d2cd06d1c0d424c10bc117565 | |
parent | 1200b98efd8f9d15417168cd4251151125e56944 (diff) | |
download | rpm-9b9e998c9afe33a5e2552ec03d33e13a22215394.tar.gz |
Fix recent rpmdb handles cleanup-on signal regression
Commit 4c6e51e2c0e3deeb052ae3c47115b6d10cb0d696 seems perfectly
sensible but managed to break rpmdb handles cleanup on signals,
ie the sole reason this mess of a code exists to begin with.
The reason that change did not work for rpm is it expects the surroundings
being sane when that's not the case: rpmdbCheckTerminate() removes
the entries from the handle lists before calling the destructor
functions, which would do the very same thing if you only let them. Not
mucking with the lists from left and right simultaneously makes things
work, what a shock.
-rw-r--r-- | lib/rpmdb.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/rpmdb.c b/lib/rpmdb.c index 7acf14a22..c6718ab43 100644 --- a/lib/rpmdb.c +++ b/lib/rpmdb.c @@ -333,23 +333,14 @@ int rpmdbCheckTerminate(int terminate) rpmdbMatchIterator mi; rpmdbIndexIterator ii; - while ((mi = rpmmiRock) != NULL) { - rpmmiRock = mi->mi_next; - mi->mi_next = NULL; + while ((mi = rpmmiRock) != NULL) rpmdbFreeIterator(mi); - } - while ((ii = rpmiiRock) != NULL) { - rpmiiRock = ii->ii_next; - ii->ii_next = NULL; + while ((ii = rpmiiRock) != NULL) rpmdbIndexIteratorFree(ii); - } - while ((db = rpmdbRock) != NULL) { - rpmdbRock = db->db_next; - db->db_next = NULL; + while ((db = rpmdbRock) != NULL) (void) rpmdbClose(db); - } } sigprocmask(SIG_SETMASK, &oldMask, NULL); return terminating; |