diff --git a/scripts/init.sql b/scripts/init.sql index c835e98a26731a1f1c4d884528c0cdbc87c820dd..3f36cb0a701e9e062c57390e4acc7a741ac4c835 100644 --- a/scripts/init.sql +++ b/scripts/init.sql @@ -91,7 +91,7 @@ CREATE TABLE IF NOT EXISTS users , PRIMARY KEY (username, password) ) WITHOUT ROWID; -INSERT INTO OR REPLACE users (username, password) VALUES ('sakura', 'hashire'); +INSERT OR REPLACE INTO users (username, password) VALUES ('sakura', 'hashire'); -- The stickers table @@ -141,3 +141,5 @@ CREATE VIEW IF NOT EXISTS queue_ AS priority, queue.position AS old_position FROM queue; + +.exit diff --git a/src/main/lktadm.c b/src/main/lktadm.c index 16b819a2ddec487dc3f6bede66f14dd83efc805d..20fc668b6c8e599c3f8b65bb08e381525391665a 100644 --- a/src/main/lktadm.c +++ b/src/main/lktadm.c @@ -220,7 +220,7 @@ init_database__(struct lkt_cmd_args *args) pid_t pid; int wstatus, status, fd; open_db(); - char *sqlite_args[] = { sqlite3_bin, db_path }; + char *sqlite_args[] = { sqlite3_bin, db_path, NULL }; if ((pid = fork()) == 0) { if ((fd = open(init_script, O_RDONLY)) < 0) @@ -229,8 +229,8 @@ init_database__(struct lkt_cmd_args *args) if (dup2(fd, 0) < 0) fail("Failed to duplicate %s to stdin", init_script); - execv(sqlite3_bin, sqlite_args); - fail("Failed to execute %s", sqlite3_bin); + execvp(sqlite_args[0], sqlite_args); + fail("Failed to execute %s: %s", sqlite3_bin, strerror(errno)); } else if (pid < 0) @@ -243,7 +243,7 @@ init_database__(struct lkt_cmd_args *args) while (!WIFEXITED(wstatus) && !WIFSIGNALED(wstatus)); if ((status = WEXITSTATUS(wstatus))) - fail("Children failed with status %d", status); + fail("Children failed with status %d\n", status); } exit(EXIT_SUCCESS);