summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/handle.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 234fc4d0..0efc0a96 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -125,12 +125,20 @@ int _alpm_handle_unlock(alpm_handle_t *handle)
close(handle->lockfd);
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;
+ 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;
}