Skip to content

FATAL ERROR: DB file open failed - patch #7

@mohan43u

Description

@mohan43u

When I tried run_root_shell, I got this message "FATAL ERROR: DB file open failed" even if both device.db and run_root_shell are in same directory. When I changed DEVICE_DATABASE_FILE to full path like "/data/local/tmp/device.db", then It started working.

So I did some changes to device_database.c (I dont know how to attach a patch in github issue, so I'm pasting my diff here. Please make this change on your branch)

diff --git a/device_database.c b/device_database.c
index f39294c..1f0692a 100644
--- a/device_database.c
+++ b/device_database.c
@@ -2,11 +2,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "../libsqlite/sqlite3.h"
 #include "device_database.h"
 
-#define DEVICE_DATABASE_FILE            "device.db"
+#define DEVICE_DATABASE_FILE            "/data/local/tmp/device.db"
 
 #define DEVICE_ID_REGISTER_START        10000
 #define SLEEP_UTIME_FOR_BUSY            10000
@@ -71,6 +72,7 @@ init_database(void)
   }
 
   if (access(DEVICE_DATABASE_FILE, R_OK | W_OK)) {
+    printf("access() failed: %s\n", strerror(errno));
     printf("FATAL ERROR: DB file open failed.\n");
     printf("Make sure install \"" DEVICE_DATABASE_FILE "\" from device_database!\n");
     exit(1);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions