summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-04-24 11:24:18 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-04-24 11:24:18 +0000
commitcdd81bf1775a0ee569a9920cf0e79d4bb6751e6f (patch)
tree55cda02113e358b5379deb7566b6f67b84b1e4ac
parent85203ff6755de92b56b6858db938bcf6f5ce6104 (diff)
downloadpacman-cdd81bf1775a0ee569a9920cf0e79d4bb6751e6f.tar.xz
- fixed a cut'n'paste bug with %REASON% entry
- factorized code between %SIZE% and %CSIZE% reading
-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);
}