Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-02-07 22:01:50 +0000
committerAurelien Foret <aurelien@archlinux.org>2006-02-07 22:01:50 +0000
commit5aa51428150b880e694d039b171ee6f8a597dbd8 (patch)
tree3fc2e6bf2e7acef37ed6a9b548f98651b11f3ee7 /lib/libalpm
parentc5aca9529f755aeeeba490ddab067679ce1ae61c (diff)
error codes cleanup
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/alpm.c16
-rw-r--r--lib/libalpm/alpm.h6
-rw-r--r--lib/libalpm/error.c7
3 files changed, 16 insertions, 13 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index d3eceefa..788e504c 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -312,7 +312,7 @@ int alpm_db_update(PM_DB *db, char *archive, char *ts)
_alpm_log(PM_LOG_ERROR, "could not remove database entry %s/%s", db->treename,
((pmpkg_t *)lp->data)->name);
}
- RET_ERR(PM_ERR_XXX, -1);
+ RET_ERR(PM_ERR_DB_REMOVE, -1);
}
}
@@ -325,12 +325,12 @@ int alpm_db_update(PM_DB *db, char *archive, char *ts)
db_write each entry (see sync_load_dbarchive to get archive content) */
_alpm_log(PM_LOG_FLOW2, "unpacking %s", archive);
if(_alpm_unpack(archive, db->path, NULL)) {
- RET_ERR(PM_ERR_XXX, -1);
+ RET_ERR(PM_ERR_SYSTEM, -1);
}
if(ts && strlen(ts) != 0) {
if(db_setlastupdate(db, ts) == -1) {
- RET_ERR(PM_ERR_XXX, -1);
+ RET_ERR(PM_ERR_SYSTEM, -1);
}
}
@@ -527,9 +527,11 @@ int alpm_pkg_load(char *filename, pmpkg_t **pkg)
int alpm_pkg_free(pmpkg_t *pkg)
{
ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
- ASSERT(pkg->origin != PKG_FROM_CACHE, RET_ERR(PM_ERR_XXX, -1));
- pkg_free(pkg);
+ /* Only free packages loaded in user space */
+ if(pkg->origin != PKG_FROM_CACHE) {
+ pkg_free(pkg);
+ }
return(0);
}
@@ -545,7 +547,7 @@ int alpm_pkg_checkmd5sum(pmpkg_t *pkg)
int retval = 0;
ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
- ASSERT(pkg->md5sum[0] != 0, RET_ERR(PM_ERR_XXX, -1));
+ ASSERT(pkg->md5sum[0] != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1));
asprintf(&path, "%s%s/%s-%s" PM_EXT_PKG,
handle->root, handle->cachedir,
@@ -719,7 +721,7 @@ int alpm_trans_sysupgrade()
trans = handle->trans;
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
- ASSERT(trans->type == PM_TRANS_TYPE_SYNC, RET_ERR(PM_ERR_XXX, -1));
+ ASSERT(trans->type == PM_TRANS_TYPE_SYNC, RET_ERR(PM_ERR_TRANS_TYPE, -1));
return(trans_sysupgrade(trans));
}
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 1980d89c..b69d5fde 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -348,6 +348,7 @@ extern enum __pmerrno_t {
PM_ERR_DB_NOT_NULL,
PM_ERR_DB_NOT_FOUND,
PM_ERR_DB_WRITE,
+ PM_ERR_DB_REMOVE,
PM_ERR_DB_UPTODATE,
/* Configuration */
PM_ERR_OPT_LOGFILE,
@@ -359,10 +360,10 @@ extern enum __pmerrno_t {
PM_ERR_TRANS_NOT_NULL,
PM_ERR_TRANS_NULL,
PM_ERR_TRANS_DUP_TARGET,
- PM_ERR_TRANS_INITIALIZED,
PM_ERR_TRANS_NOT_INITIALIZED,
PM_ERR_TRANS_NOT_PREPARED,
PM_ERR_TRANS_ABORT,
+ PM_ERR_TRANS_TYPE,
/* Packages */
PM_ERR_PKG_NOT_FOUND,
PM_ERR_PKG_INVALID,
@@ -379,8 +380,7 @@ extern enum __pmerrno_t {
PM_ERR_FILE_CONFLICTS,
/* Misc */
PM_ERR_USER_ABORT,
- PM_ERR_INTERNAL_ERROR,
- PM_ERR_XXX
+ PM_ERR_INTERNAL_ERROR
} pm_errno;
char *alpm_strerror(int err);
diff --git a/lib/libalpm/error.c b/lib/libalpm/error.c
index 54220e0b..1428ff35 100644
--- a/lib/libalpm/error.c
+++ b/lib/libalpm/error.c
@@ -55,6 +55,8 @@ char *alpm_strerror(int err)
return "could not find database";
case PM_ERR_DB_WRITE:
return "could not update database";
+ case PM_ERR_DB_REMOVE:
+ return "could not remove database entry";
case PM_ERR_DB_UPTODATE:
return "database is up to date";
/* Configuration */
@@ -71,14 +73,14 @@ char *alpm_strerror(int err)
return "transaction already initialized";
case PM_ERR_TRANS_DUP_TARGET:
return "duplicate target";
- case PM_ERR_TRANS_INITIALIZED:
- return "transaction already initialized";
case PM_ERR_TRANS_NOT_INITIALIZED:
return "transaction not initialized";
case PM_ERR_TRANS_NOT_PREPARED:
return "transaction not prepared";
case PM_ERR_TRANS_ABORT:
return "transaction aborted";
+ case PM_ERR_TRANS_TYPE:
+ return "operation not compatible with the transaction type";
/* Packages */
case PM_ERR_PKG_NOT_FOUND:
return "could not find or read package";
@@ -109,7 +111,6 @@ char *alpm_strerror(int err)
return "user aborted";
case PM_ERR_INTERNAL_ERROR:
return "internal error";
- case PM_ERR_XXX:
default:
return "unexpected error";
}