mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-25 06:35:57 -05:00
Move db_open after priv drop
This commit is contained in:
parent
5a435bc6e9
commit
f8f442bc3c
@ -161,6 +161,7 @@ int db_sqlite_free_table(char **resarray) {
|
||||
db_sqlite_lock();
|
||||
sqlite_free_table(resarray);
|
||||
db_sqlite_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -174,7 +175,7 @@ int db_sqlite_open(char *parameters) {
|
||||
snprintf(db_path,sizeof(db_path),"%s/songs.db",parameters);
|
||||
|
||||
db_sqlite_lock();
|
||||
db_sqlite_songs=sqlite_open(db_path,0,&perr);
|
||||
db_sqlite_songs=sqlite_open(db_path,0666,&perr);
|
||||
if(!db_sqlite_songs)
|
||||
DPRINTF(E_FATAL,L_DB,"db_sqlite_open: %s (%s)\n",perr,db_path);
|
||||
|
||||
@ -727,7 +728,7 @@ int db_sqlite_enum_fetch(DBQUERYINFO *pinfo, unsigned char **pdmap) {
|
||||
db_sqlite_unlock();
|
||||
|
||||
DPRINTF(E_FATAL,L_DB,"sqlite_step: %s\n",perr);
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
10
src/main.c
10
src/main.c
@ -452,11 +452,6 @@ int main(int argc, char *argv[]) {
|
||||
daemon_start();
|
||||
}
|
||||
|
||||
/* DWB: shouldn't this be done after dropping privs? */
|
||||
if(db_open(config.dbdir))
|
||||
DPRINTF(E_FATAL,L_MAIN|L_DB,"Error in db_open: %s\n",strerror(errno));
|
||||
|
||||
|
||||
// Drop privs here
|
||||
if(drop_privs(config.runas)) {
|
||||
DPRINTF(E_FATAL,L_MAIN,"Error in drop_privs: %s\n",strerror(errno));
|
||||
@ -478,6 +473,11 @@ int main(int argc, char *argv[]) {
|
||||
fprintf(pid_fp,"%d\n",config.pid);
|
||||
fclose(pid_fp);
|
||||
}
|
||||
|
||||
/* this will require that the db be readable by the runas user */
|
||||
if(db_open(config.dbdir))
|
||||
DPRINTF(E_FATAL,L_MAIN|L_DB,"Error in db_open: %s\n",strerror(errno));
|
||||
|
||||
/* Initialize the database before starting */
|
||||
DPRINTF(E_LOG,L_MAIN|L_DB,"Initializing database\n");
|
||||
if(db_init(reload)) {
|
||||
|
Loading…
Reference in New Issue
Block a user