when we create log files, be sure to they're umasked to 066
git-svn-id: https://svn.musicpd.org/mpd/trunk@1443 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
43b355734c
commit
aed9c23ec6
10
src/main.c
10
src/main.c
@ -124,10 +124,12 @@ void parseOptions(int argc, char ** argv, Options * options) {
|
|||||||
argcLeft--;
|
argcLeft--;
|
||||||
}
|
}
|
||||||
else if(strcmp(argv[i],"--create-db")==0) {
|
else if(strcmp(argv[i],"--create-db")==0) {
|
||||||
|
options->stdOutput = 1;
|
||||||
options->createDB = 1;
|
options->createDB = 1;
|
||||||
argcLeft--;
|
argcLeft--;
|
||||||
}
|
}
|
||||||
else if(strcmp(argv[i],"--update-db")==0) {
|
else if(strcmp(argv[i],"--update-db")==0) {
|
||||||
|
options->stdOutput = 1;
|
||||||
options->updateDB = 1;
|
options->updateDB = 1;
|
||||||
argcLeft--;
|
argcLeft--;
|
||||||
}
|
}
|
||||||
@ -289,11 +291,16 @@ void changeToUser(Options * options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void openLogFiles(Options * options, FILE ** out, FILE ** err) {
|
void openLogFiles(Options * options, FILE ** out, FILE ** err) {
|
||||||
|
mode_t prev;
|
||||||
|
|
||||||
if(options->stdOutput) {
|
if(options->stdOutput) {
|
||||||
flushWarningLog();
|
flushWarningLog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* be sure to create log files w/ rw permissions*/
|
||||||
|
prev = umask(0066);
|
||||||
|
|
||||||
if(NULL==(*out=fopen(options->logFile,"a"))) {
|
if(NULL==(*out=fopen(options->logFile,"a"))) {
|
||||||
ERROR("problem opening file \"%s\" for writing\n",
|
ERROR("problem opening file \"%s\" for writing\n",
|
||||||
options->logFile);
|
options->logFile);
|
||||||
@ -305,6 +312,8 @@ void openLogFiles(Options * options, FILE ** out, FILE ** err) {
|
|||||||
options->errorFile);
|
options->errorFile);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
umask(prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void openDB(Options * options, char * argv0) {
|
void openDB(Options * options, char * argv0) {
|
||||||
@ -477,4 +486,3 @@ int main(int argc, char * argv[]) {
|
|||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
|
|
||||||
|
Loading…
Reference in New Issue
Block a user