mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
added more error messages, enabled the db permission check in trans_commit
This commit is contained in:
parent
79a20cdc96
commit
6f75de92b5
@ -615,8 +615,8 @@ int alpm_trans_commit()
|
|||||||
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
||||||
ASSERT(trans->state == STATE_PREPARED, RET_ERR(PM_ERR_TRANS_NOT_PREPARED, -1));
|
ASSERT(trans->state == STATE_PREPARED, RET_ERR(PM_ERR_TRANS_NOT_PREPARED, -1));
|
||||||
|
|
||||||
/* ORE
|
/* Check for database R/W permission */
|
||||||
ASSERT(handle->access != PM_ACCESS_RW, RET_ERR(PM_ERR_BAD_PERMS, -1));*/
|
ASSERT(handle->access == PM_ACCESS_RW, RET_ERR(PM_ERR_BADPERMS, -1));
|
||||||
|
|
||||||
return(trans_commit(handle->trans));
|
return(trans_commit(handle->trans));
|
||||||
}
|
}
|
||||||
|
@ -310,8 +310,8 @@ extern enum __pmerrno_t {
|
|||||||
PM_ERR_DB_OPEN,
|
PM_ERR_DB_OPEN,
|
||||||
PM_ERR_DB_CREATE,
|
PM_ERR_DB_CREATE,
|
||||||
PM_ERR_DB_NULL,
|
PM_ERR_DB_NULL,
|
||||||
PM_ERR_DB_NOT_FOUND,
|
|
||||||
PM_ERR_DB_NOT_NULL,
|
PM_ERR_DB_NOT_NULL,
|
||||||
|
PM_ERR_DB_NOT_FOUND,
|
||||||
PM_ERR_DB_WRITE,
|
PM_ERR_DB_WRITE,
|
||||||
PM_ERR_DB_UPTODATE,
|
PM_ERR_DB_UPTODATE,
|
||||||
/* Cache */
|
/* Cache */
|
||||||
|
@ -25,6 +25,14 @@ char *alpm_strerror(int err)
|
|||||||
{
|
{
|
||||||
switch(err) {
|
switch(err) {
|
||||||
/* System */
|
/* System */
|
||||||
|
case PM_ERR_MEMORY:
|
||||||
|
return "out of memory!";
|
||||||
|
case PM_ERR_SYSTEM:
|
||||||
|
return "unexpected error";
|
||||||
|
case PM_ERR_BADPERMS:
|
||||||
|
return "insufficient privileges";
|
||||||
|
case PM_ERR_WRONG_ARGS:
|
||||||
|
return "wrong or NULL argument passed";
|
||||||
case PM_ERR_NOT_A_FILE:
|
case PM_ERR_NOT_A_FILE:
|
||||||
return "could not find or read file";
|
return "could not find or read file";
|
||||||
/* Interface */
|
/* Interface */
|
||||||
@ -32,8 +40,8 @@ char *alpm_strerror(int err)
|
|||||||
return "library not initialized";
|
return "library not initialized";
|
||||||
case PM_ERR_HANDLE_NOT_NULL:
|
case PM_ERR_HANDLE_NOT_NULL:
|
||||||
return "library already initialized";
|
return "library already initialized";
|
||||||
case PM_ERR_WRONG_ARGS:
|
case PM_ERR_HANDLE_LOCK:
|
||||||
return "wrong or NULL argument";
|
return "unable to lock database";
|
||||||
/* Databases */
|
/* Databases */
|
||||||
case PM_ERR_DB_OPEN:
|
case PM_ERR_DB_OPEN:
|
||||||
return "could not open database";
|
return "could not open database";
|
||||||
@ -45,9 +53,17 @@ char *alpm_strerror(int err)
|
|||||||
return "database already registered";
|
return "database already registered";
|
||||||
case PM_ERR_DB_NOT_FOUND:
|
case PM_ERR_DB_NOT_FOUND:
|
||||||
return "could not find database";
|
return "could not find database";
|
||||||
|
case PM_ERR_DB_WRITE:
|
||||||
|
return "could not update database";
|
||||||
|
case PM_ERR_DB_UPTODATE:
|
||||||
|
return "database is up to date";
|
||||||
|
/* Cache */
|
||||||
|
case PM_ERR_CACHE_NULL:
|
||||||
|
return "cache not initialized";
|
||||||
/* Configuration */
|
/* Configuration */
|
||||||
case PM_ERR_OPT_LOGFILE:
|
case PM_ERR_OPT_LOGFILE:
|
||||||
case PM_ERR_OPT_DBPATH:
|
case PM_ERR_OPT_DBPATH:
|
||||||
|
case PM_ERR_OPT_LOCALDB:
|
||||||
case PM_ERR_OPT_SYNCDB:
|
case PM_ERR_OPT_SYNCDB:
|
||||||
case PM_ERR_OPT_USESYSLOG:
|
case PM_ERR_OPT_USESYSLOG:
|
||||||
return "could not set parameter";
|
return "could not set parameter";
|
||||||
@ -57,22 +73,33 @@ char *alpm_strerror(int err)
|
|||||||
case PM_ERR_TRANS_NOT_NULL:
|
case PM_ERR_TRANS_NOT_NULL:
|
||||||
return "transaction already initialized";
|
return "transaction already initialized";
|
||||||
case PM_ERR_TRANS_DUP_TARGET:
|
case PM_ERR_TRANS_DUP_TARGET:
|
||||||
return "duplicated target";
|
return "duplicate target";
|
||||||
case PM_ERR_TRANS_INITIALIZED:
|
case PM_ERR_TRANS_INITIALIZED:
|
||||||
return "transaction already initialized";
|
return "transaction already initialized";
|
||||||
case PM_ERR_TRANS_NOT_INITIALIZED:
|
case PM_ERR_TRANS_NOT_INITIALIZED:
|
||||||
return "transaction not initialized";
|
return "transaction not initialized";
|
||||||
|
case PM_ERR_TRANS_NOT_PREPARED:
|
||||||
|
return "transaction not prepared";
|
||||||
|
case PM_ERR_TRANS_ABORT:
|
||||||
|
return "transaction aborted";
|
||||||
/* Packages */
|
/* Packages */
|
||||||
case PM_ERR_PKG_NOT_FOUND:
|
case PM_ERR_PKG_NOT_FOUND:
|
||||||
return "could not find or read package";
|
return "could not find or read package";
|
||||||
case PM_ERR_PKG_INVALID:
|
case PM_ERR_PKG_INVALID:
|
||||||
return "invalid or corrupted package";
|
return "invalid or corrupted package";
|
||||||
|
case PM_ERR_PKG_OPEN:
|
||||||
|
return "cannot open package file";
|
||||||
|
case PM_ERR_PKG_LOAD:
|
||||||
|
return "cannot load package data";
|
||||||
case PM_ERR_PKG_INSTALLED:
|
case PM_ERR_PKG_INSTALLED:
|
||||||
return "package already installed";
|
return "package already installed";
|
||||||
case PM_ERR_PKG_CANT_FRESH:
|
case PM_ERR_PKG_CANT_FRESH:
|
||||||
return "package not installed or lesser version";
|
return "package not installed or lesser version";
|
||||||
case PM_ERR_PKG_INVALID_NAME:
|
case PM_ERR_PKG_INVALID_NAME:
|
||||||
return "package name is not valid";
|
return "package name is not valid";
|
||||||
|
/* Groups */
|
||||||
|
case PM_ERR_GRP_NOT_FOUND:
|
||||||
|
return "group not found";
|
||||||
/* Dependencies */
|
/* Dependencies */
|
||||||
case PM_ERR_UNSATISFIED_DEPS:
|
case PM_ERR_UNSATISFIED_DEPS:
|
||||||
return "could not satisfy dependencies";
|
return "could not satisfy dependencies";
|
||||||
@ -82,9 +109,12 @@ char *alpm_strerror(int err)
|
|||||||
return "could not resolve dependencies";
|
return "could not resolve dependencies";
|
||||||
case PM_ERR_FILE_CONFLICTS:
|
case PM_ERR_FILE_CONFLICTS:
|
||||||
return "conflicting files";
|
return "conflicting files";
|
||||||
/* System */
|
/* Miscellaenous */
|
||||||
case PM_ERR_HANDLE_LOCK:
|
case PM_ERR_USER_ABORT:
|
||||||
return "could not create the lock file";
|
return "user aborted";
|
||||||
|
case PM_ERR_INTERNAL_ERROR:
|
||||||
|
return "internal error";
|
||||||
|
case PM_ERR_XXX:
|
||||||
default:
|
default:
|
||||||
return "unexpected error";
|
return "unexpected error";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user