]> git.ipfire.org Git - pakfire.git/commitdiff
db: Check for errors after INSERT
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Mar 2021 01:29:33 +0000 (01:29 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Mar 2021 01:29:33 +0000 (01:29 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/db.c

index 82e1af166b65d784d4f2fc0c8c2f7678f5cdddd6..c3be9889d7f6b72e6f44269c643461620ce4c723 100644 (file)
@@ -906,6 +906,13 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, Pakfire
                // Move on to next file
                pakfire_file_unref(file);
 
+               // Check for errors
+               if (r != SQLITE_DONE) {
+                       ERROR(db->pakfire, "Could not add file to database: %s\n",
+                               sqlite3_errmsg(db->handle));
+                       goto END;
+               }
+
                // Reset bound values
                sqlite3_reset(stmt);
        }
@@ -975,6 +982,13 @@ static int pakfire_db_add_scriptlets(struct pakfire_db* db, unsigned long id, Pa
                        r = sqlite3_step(stmt);
                } while (r == SQLITE_BUSY);
 
+               // Check for errors
+               if (r != SQLITE_DONE) {
+                       ERROR(db->pakfire, "Could not add scriptlet to database: %s\n",
+                               sqlite3_errmsg(db->handle));
+                       goto END;
+               }
+
                // Reset bound values
                sqlite3_reset(stmt);