Fix bug for wrong string comparison 59/161259/1
authorInkyun Kil <inkyun.kil@samsung.com>
Wed, 22 Nov 2017 10:20:19 +0000 (19:20 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Wed, 22 Nov 2017 10:20:19 +0000 (19:20 +0900)
Change-Id: Ia0559e075c175b3d9bc8d58413013e77b5f8d4a8
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
backend/sqlite.c

index 35f7023..78a1c5c 100644 (file)
@@ -96,7 +96,7 @@ static sqlite3 *open_sqlite3(const char *dbpath, bool readonly)
        if (db_exist && r == SQLITE_CORRUPT) {
                bxt_err("Open '%s' failed: %s", dbpath, sqlite3_errmsg(db));
 
-               if (!strncmp(BASE_DB_PATH, dbpath, strlen(dbpath))) {
+               if (!strncmp(BASE_DB_PATH, dbpath, strlen(BASE_DB_PATH))) {
                        free(nm);
                        return NULL;
                }
@@ -123,7 +123,7 @@ static sqlite3 *open_sqlite3(const char *dbpath, bool readonly)
        }
 
        if (!db_exist) {
-               if (strncmp(BASE_DB_PATH, dbpath, strlen(dbpath))) {
+               if (strncmp(BASE_DB_PATH, dbpath, strlen(BASE_DB_PATH))) {
                        r = sqlite3_exec(db, "PRAGMA journal_mode = WAL",
                                        NULL, NULL, NULL);
                        if (r) {
@@ -146,7 +146,7 @@ static sqlite3 *open_sqlite3(const char *dbpath, bool readonly)
                }
        }
 
-       if (strncmp(BASE_DB_PATH, dbpath, strlen(dbpath))) {
+       if (strncmp(BASE_DB_PATH, dbpath, strlen(BASE_DB_PATH))) {
                r = sqlite3_wal_autocheckpoint(db, BUXTON_DEFAULT_WAL_AUTOCHECKPOINT);
                if (r != SQLITE_OK)
                        bxt_err("SET DEFAULT_WAL_AUTOCHECKPOINT failed : %d", r);