summaryrefslogtreecommitdiff
path: root/lib/libalpm/db.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/db.c')
-rw-r--r--lib/libalpm/db.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 7052d132..60850489 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -266,6 +266,12 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
return(-1);
}
+ if(info->name[0] == 0) {
+ if(pkg_splitname(name, info->name, info->version) == -1) {
+ return(-1);
+ }
+ }
+
/* DESC */
if(inforeq & INFRQ_DESC) {
snprintf(path, PATH_MAX, "%s/%s/desc", db->path, name);
@@ -279,17 +285,7 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
break;
}
_alpm_strtrim(line);
- if(!strcmp(line, "%NAME%")) {
- if(fgets(info->name, sizeof(info->name), fp) == NULL) {
- return(-1);
- }
- _alpm_strtrim(info->name);
- } else if(!strcmp(line, "%VERSION%")) {
- if(fgets(info->version, sizeof(info->version), fp) == NULL) {
- return(-1);
- }
- _alpm_strtrim(info->version);
- } else if(!strcmp(line, "%DESC%")) {
+ if(!strcmp(line, "%DESC%")) {
if(fgets(info->desc, sizeof(info->desc), fp) == NULL) {
return(-1);
}