Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix race condition in lock upgrade.
Vsevolod Stakhov committed 12 years ago
commit 08e12d5ffd2edfea9c24a662da2387cc212cdd1b
parent ab7b488
1 file changed +7 -0
modified libpkg/pkgdb.c
@@ -4186,6 +4186,13 @@ pkgdb_try_lock(struct pkgdb *db, const char *lock_sql,
				/* No live processes found, so we can safely reset lock */
				pkg_debug(1, "no concurrent processes found, cleanup the lock");
				pkgdb_reset_lock(db);
+
				if (upgrade) {
+
					/*
+
					 * In case of upgrade we should obtain a lock from the beginning,
+
					 * hence switch upgrade to retain
+
					 */
+
					return pkgdb_obtain_lock(db, type, delay, retries - tries);
+
				}
				continue;
			}
			else if (delay > 0) {