]> pd.if.org Git - zpackage/commitdiff
rollback on initialize failure
authorNathan Wagner <nw@hydaspes.if.org>
Sun, 30 Sep 2018 23:09:18 +0000 (23:09 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Sun, 30 Sep 2018 23:09:18 +0000 (23:09 +0000)
lib/zpm.c

index 30e8dc81cdeb15617f5a8089533d792898445373..b7d97776659c5c7b22bc6aec59462b2b2e58a138 100644 (file)
--- a/lib/zpm.c
+++ b/lib/zpm.c
@@ -258,7 +258,6 @@ static
 #include "newdb.c"
 
 int zpm_db_initialize(struct zpm *pkg) {
-       //fprintf(stderr, "initializing zpm database\n");
        char *error;
        switch (sqlite3_exec(pkg->db, createdb, (int (*)(void *,int,char **,char **))0, NULL, &error)) {
                case SQLITE_OK: break;
@@ -266,6 +265,7 @@ int zpm_db_initialize(struct zpm *pkg) {
                        SQLERROR(sqlite3_errmsg(pkg->db));
                        fprintf(stderr, "error: %s\n", error);
                        sqlite3_free(error);
+                       zpm_rollback(pkg);
                        return 0;
                        break;
        }