summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/db.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 29547e20..70d5f8e1 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -330,14 +330,7 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
}
_alpm_strtrim(tmp);
info->reason = atol(tmp);
- } else if(!strcmp(line, "%SIZE%")) {
- char tmp[32];
- if(fgets(tmp, sizeof(tmp), fp) == NULL) {
- return(-1);
- }
- _alpm_strtrim(tmp);
- info->size = atol(tmp);
- } else if(!strcmp(line, "%CSIZE%")) {
+ } else if(!strcmp(line, "%SIZE%") || !strcmp(line, "%CSIZE%")) {
/* NOTE: the CSIZE and SIZE fields both share the "size" field
* in the pkginfo_t struct. This can be done b/c CSIZE
* is currently only used in sync databases, and SIZE is
@@ -490,7 +483,7 @@ int db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
fputs("%SIZE%\n", fp);
fprintf(fp, "%ld\n\n", info->size);
fputs("%REASON%\n", fp);
- fprintf(fp, "%ld\n\n", info->size);
+ fprintf(fp, "%ld\n\n", info->reason);
fclose(fp);
}