mirror of
https://github.com/owntone/owntone-server.git
synced 2025-03-31 09:43:45 -04:00
Perform explicit sqlite3 init/deinit
This commit is contained in:
parent
4551d530f9
commit
0411720a58
13
src/db.c
13
src/db.c
@ -3931,6 +3931,13 @@ db_init(void)
|
|||||||
|
|
||||||
db_path = cfg_getstr(cfg_getsec(cfg, "general"), "db_path");
|
db_path = cfg_getstr(cfg_getsec(cfg, "general"), "db_path");
|
||||||
|
|
||||||
|
ret = sqlite3_initialize();
|
||||||
|
if (ret != SQLITE_OK)
|
||||||
|
{
|
||||||
|
DPRINTF(E_FATAL, L_DB, "SQLite3 failed to initialize\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!sqlite3_threadsafe())
|
if (!sqlite3_threadsafe())
|
||||||
{
|
{
|
||||||
DPRINTF(E_FATAL, L_DB, "The SQLite3 library is not built with a threadsafe configuration\n");
|
DPRINTF(E_FATAL, L_DB, "The SQLite3 library is not built with a threadsafe configuration\n");
|
||||||
@ -3964,3 +3971,9 @@ db_init(void)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
db_deinit(void)
|
||||||
|
{
|
||||||
|
sqlite3_shutdown();
|
||||||
|
}
|
||||||
|
3
src/db.h
3
src/db.h
@ -445,4 +445,7 @@ db_perthread_deinit(void);
|
|||||||
int
|
int
|
||||||
db_init(void);
|
db_init(void);
|
||||||
|
|
||||||
|
void
|
||||||
|
db_deinit(void);
|
||||||
|
|
||||||
#endif /* !__DB_H__ */
|
#endif /* !__DB_H__ */
|
||||||
|
@ -748,7 +748,9 @@ main(int argc, char **argv)
|
|||||||
filescanner_deinit();
|
filescanner_deinit();
|
||||||
|
|
||||||
filescanner_fail:
|
filescanner_fail:
|
||||||
|
DPRINTF(E_LOG, L_MAIN, "Database deinit\n");
|
||||||
db_perthread_deinit();
|
db_perthread_deinit();
|
||||||
|
db_deinit();
|
||||||
db_fail:
|
db_fail:
|
||||||
if (ret == EXIT_FAILURE)
|
if (ret == EXIT_FAILURE)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user