Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FATAL ERROR: DB file open failed - patch #7

Open
mohan43u opened this issue Dec 30, 2013 · 0 comments
Open

FATAL ERROR: DB file open failed - patch #7

mohan43u opened this issue Dec 30, 2013 · 0 comments

Comments

@mohan43u
Copy link

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant