handle_unlock: log lock removal failure

Rather than have individual callers log failure, just
do it directly in _alpm_handle_unlock.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andrew Gregory 2014-08-01 14:19:50 -07:00 committed by Allan McRae
parent 7f1360b440
commit 03b9bf08ac
3 changed files with 6 additions and 11 deletions

View File

@ -291,11 +291,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
}
cleanup:
if(_alpm_handle_unlock(handle)) {
_alpm_log(handle, ALPM_LOG_WARNING, _("could not remove lock file %s\n"),
handle->lockfile);
}
_alpm_handle_unlock(handle);
free(syncpath);
umask(oldmask);
return ret;

View File

@ -126,6 +126,10 @@ int _alpm_handle_unlock(alpm_handle_t *handle)
handle->lockfd = -1;
if(unlink(handle->lockfile) && errno != ENOENT) {
_alpm_log(handle, ALPM_LOG_WARNING,
_("could not remove lock file %s\n"), handle->lockfile);
alpm_logaction(handle, ALPM_CALLER_PREFIX,
"warning: could not remove lock file %s\n", handle->lockfile);
return -1;
}
return 0;

View File

@ -231,12 +231,7 @@ int SYMEXPORT alpm_trans_release(alpm_handle_t *handle)
/* unlock db */
if(!nolock_flag) {
if(_alpm_handle_unlock(handle)) {
_alpm_log(handle, ALPM_LOG_WARNING, _("could not remove lock file %s\n"),
handle->lockfile);
alpm_logaction(handle, ALPM_CALLER_PREFIX,
"warning: could not remove lock file %s\n", handle->lockfile);
}
_alpm_handle_unlock(handle);
}
return 0;