log: redirect stdout/stderr to /dev/null if syslog is used
Don't hold a file descriptor on root's tty when syslog is used for logging.
This commit is contained in:
parent
375fd5ed4c
commit
c440faa94d
1
NEWS
1
NEWS
|
@ -61,6 +61,7 @@ ver 0.16 (20??/??/??)
|
||||||
* removed options --create-db and --no-create-db
|
* removed options --create-db and --no-create-db
|
||||||
* state_file: save only if something has changed
|
* state_file: save only if something has changed
|
||||||
* database: eliminated maximum line length
|
* database: eliminated maximum line length
|
||||||
|
* log: redirect stdout/stderr to /dev/null if syslog is used
|
||||||
* obey $(sysconfdir) for default mpd.conf location
|
* obey $(sysconfdir) for default mpd.conf location
|
||||||
* build with large file support by default
|
* build with large file support by default
|
||||||
* require GLib 2.16
|
* require GLib 2.16
|
||||||
|
|
|
@ -271,7 +271,10 @@ void setup_log_output(bool use_stdout)
|
||||||
{
|
{
|
||||||
fflush(NULL);
|
fflush(NULL);
|
||||||
if (!use_stdout) {
|
if (!use_stdout) {
|
||||||
if (out_filename != NULL) {
|
if (out_filename == NULL)
|
||||||
|
out_fd = open("/dev/null", O_WRONLY);
|
||||||
|
|
||||||
|
if (out_fd >= 0) {
|
||||||
redirect_logs(out_fd);
|
redirect_logs(out_fd);
|
||||||
close(out_fd);
|
close(out_fd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue