fix wrong errno return issue 70/99570/1
authorJiwoong Im <jiwoong.im@samsung.com>
Wed, 23 Nov 2016 09:12:15 +0000 (18:12 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Wed, 23 Nov 2016 09:12:15 +0000 (18:12 +0900)
Change-Id: Ie8e4b19304a577645f9b3ab3c21d5cbf6f500832
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
backend/sqlite.c

index 95d2a3f..13268ec 100644 (file)
@@ -40,10 +40,13 @@ static GHashTable *dbs;
 
 static void free_db(sqlite3 *db)
 {
+       int errno_backup;
        if (!db)
                return;
 
-       sqlite3_close(db);
+       errno_backup = errno;
+       if (sqlite3_close(db) == SQLITE_OK)
+               errno = errno_backup;
 }
 
 static sqlite3 *open_sqlite3(const char *dbpath, bool readonly)