Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 0fa2e54c rédigé par Kubat's avatar Kubat
Parcourir les fichiers

Fix the database init

parent 29d49d6d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!64Resolve "Installation"
......@@ -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
......@@ -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);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter