summaryrefslogtreecommitdiff
path: root/src/state.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-07-22 16:11:21 +0300
committerTimo Teras <timo.teras@iki.fi>2009-07-22 16:11:21 +0300
commit9dc60e8d1cb651617b13d1e63974a1a515021987 (patch)
treed1badbf5d68d25daa3d82bf77862baf8a1d655b0 /src/state.c
parent5375efac1af6488f8af5063fab243fe844334f05 (diff)
downloadapk-tools-9dc60e8d1cb651617b13d1e63974a1a515021987.tar.gz
apk-tools-9dc60e8d1cb651617b13d1e63974a1a515021987.tar.bz2
apk-tools-9dc60e8d1cb651617b13d1e63974a1a515021987.tar.xz
apk-tools-9dc60e8d1cb651617b13d1e63974a1a515021987.zip
state: commit fdb changes even on error
we might have done already something.
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/state.c b/src/state.c
index 44649de..c342c2f 100644
--- a/src/state.c
+++ b/src/state.c
@@ -690,6 +690,7 @@ int apk_state_commit(struct apk_state *state,
}
/* Go through changes */
+ r = 0;
list_for_each_entry(change, &state->change_list_head, change_list) {
apk_print_change(db, change->oldpkg, change->newpkg);
prog.pkg = change->newpkg;
@@ -700,7 +701,7 @@ int apk_state_commit(struct apk_state *state,
(apk_flags & APK_PROGRESS) ? progress_cb : NULL,
&prog);
if (r != 0)
- return r;
+ break;
}
apk_count_change(change, &prog.done);
@@ -708,13 +709,14 @@ int apk_state_commit(struct apk_state *state,
if (apk_flags & APK_PROGRESS)
apk_draw_progress(20, 1);
- if (!(apk_flags & APK_SIMULATE))
+ if (!(apk_flags & APK_SIMULATE) && prog.done.packages != 0)
apk_db_write_config(db);
- apk_message("OK: %d packages, %d dirs, %d files",
- db->installed.stats.packages,
- db->installed.stats.dirs,
- db->installed.stats.files);
+ if (r != 0)
+ apk_message("OK: %d packages, %d dirs, %d files",
+ db->installed.stats.packages,
+ db->installed.stats.dirs,
+ db->installed.stats.files);
- return 0;
+ return r;
}