mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-10 11:35:00 -05:00
handle_unlock: log error when lock file is missing
Problems due to concurrent running instances of pacman can be difficult to diagnose. Log a warning to make it more obvious that that's what happened, that it's a bad idea, and hopefully encourage people who do things like removing the lock file to run pacman from an install script to at least be courteous enough to put it back when they're done. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
03b9bf08ac
commit
0bf4ae726d
@ -125,13 +125,21 @@ int _alpm_handle_unlock(alpm_handle_t *handle)
|
||||
close(handle->lockfd);
|
||||
handle->lockfd = -1;
|
||||
|
||||
if(unlink(handle->lockfile) && errno != ENOENT) {
|
||||
if(unlink(handle->lockfile) != 0) {
|
||||
if(errno == ENOENT) {
|
||||
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||
_("lock file missing %s\n"), handle->lockfile);
|
||||
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
||||
"warning: lock file missing %s\n", handle->lockfile);
|
||||
return 0;
|
||||
} else {
|
||||
_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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user