mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
Give better error messages on database locking failures
This was noted when trying to perform an operation on a pacman database on a read-only file system. Print the actual underlying errno string, and only show the "you can remove" message if the lock file actually exists. Before: $ pacman -Su error: failed to init transaction (unable to lock database) if you're sure a package manager is not already running, you can remove /e/db.lck After: $ pacman -Su error: failed to init transaction (unable to lock database) error: could not lock database: Read-only file system Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
4899b5bd86
commit
fe659153d5
@ -69,9 +69,13 @@ void trans_init_error(void)
|
||||
pm_printf(ALPM_LOG_ERROR, _("failed to init transaction (%s)\n"),
|
||||
alpm_strerror(err));
|
||||
if(err == ALPM_ERR_HANDLE_LOCK) {
|
||||
fprintf(stderr, _(" if you're sure a package manager is not already\n"
|
||||
" running, you can remove %s\n"),
|
||||
alpm_option_get_lockfile(config->handle));
|
||||
const char *lockfile = alpm_option_get_lockfile(config->handle);
|
||||
pm_printf(ALPM_LOG_ERROR, _("could not lock database: %s\n"),
|
||||
strerror(errno));
|
||||
if(access(lockfile, F_OK) == 0) {
|
||||
fprintf(stderr, _(" if you're sure a package manager is not already\n"
|
||||
" running, you can remove %s\n"), lockfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user