From af15744967957d4c14be9a0024475e335a2c4470 Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Wed, 5 Oct 2005 21:50:58 +0000 Subject: Applied reworked patch from VMiklos (vmiklos@frugalware.org) Close the lock file descriptor upon handle release --- lib/libalpm/alpm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/libalpm/alpm.c') diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index ce83f664..7cf86922 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -74,7 +74,8 @@ int alpm_initialize(char *root) /* lock db */ if(handle->access == PM_ACCESS_RW) { - if(_alpm_lckmk(PM_LOCK) == -1) { + handle->lckfd = _alpm_lckmk(PM_LOCK); + if(handle->lckfd == -1) { FREE(handle); RET_ERR(PM_ERR_HANDLE_LOCK, -1); } @@ -98,6 +99,10 @@ int alpm_release() /* 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); -- cgit v1.2.3-54-g00ecf