[Frugalware-darcs] pacman: move db lock/unlock to the transaction functions

VMiklos vmiklos at frugalware.org
Thu Mar 16 17:47:03 CET 2006


[move db lock/unlock to the transaction functions
VMiklos <vmiklos at frugalware.org>**20060125234058
 $ sudo touch /tmp/pacman.lck
 $ sudo pacman -Sg
 error: failed to initilize alpm library (unable to lock database)
 error: library not initialized
 is this normal? of course not
 we should only lock the database when a transaction begins, and
 we should unlock the database as soon as the transaction ends
] {
hunk ./lib/libalpm/alpm.c 55
-#define PM_LOCK   "/tmp/pacman.lck"
-
hunk ./lib/libalpm/alpm.c 79
-	/* lock db */
-	if(handle->access == PM_ACCESS_RW) {
-		handle->lckfd = _alpm_lckmk(PM_LOCK);
-		if(handle->lckfd == -1) {
-			FREE(handle);
-			RET_ERR(PM_ERR_HANDLE_LOCK, -1);
-		}
-	}
-
hunk ./lib/libalpm/alpm.c 98
-	/* unlock db */
-	if(handle->access == PM_ACCESS_RW) {
-		if(handle->lckfd != -1) {
-			close(handle->lckfd);
-			handle->lckfd = -1;
-		}
-		if(_alpm_lckrm(PM_LOCK)) {
-			_alpm_log(PM_LOG_WARNING, "could not remove lock file %s", PM_LOCK);
-			alpm_logaction("warning: could not remove lock file %s", PM_LOCK);
-		}
-	}
-
hunk ./lib/libalpm/alpm.c 662
+	/* lock db */
+	if(handle->access == PM_ACCESS_RW) {
+		handle->lckfd = _alpm_lckmk(PM_LOCK);
+		if(handle->lckfd == -1) {
+			FREE(handle);
+			RET_ERR(PM_ERR_HANDLE_LOCK, -1);
+		}
+	}
+
hunk ./lib/libalpm/alpm.c 773
+	/* unlock db */
+	if(handle->access == PM_ACCESS_RW) {
+		if(handle->lckfd != -1) {
+			close(handle->lckfd);
+			handle->lckfd = -1;
+		}
+		if(_alpm_lckrm(PM_LOCK)) {
+			_alpm_log(PM_LOG_WARNING, "could not remove lock file %s", PM_LOCK);
+			alpm_logaction("warning: could not remove lock file %s", PM_LOCK);
+		}
+	}
+
hunk ./lib/libalpm/alpm.h 35
+#define PM_LOCK     "/tmp/pacman.lck"
+
}


More information about the Frugalware-darcs mailing list