config_get_path() was somewhat flawed, because it pretended to be a
function, when it really had a side effect. The second flaw was that
it did not return the parser error, instead it aborted the whole
process, which is bad style. The new function returns a duplicated
(modified) string that must be freed by the caller, and returns a
GError on failure.
Replaced all occurrences of g_error() with MPD_ERROR() located in a new header
file 'mpd_error.h'. This macro uses g_critical() to print the error message
and then exits gracefully in contrast to g_error() which would internally call
abort() to produce a core dump.
The macro name is distinctive and allows to find all places with dubious error
handling. The long-term goal is to get rid of MPD_ERROR() altogether. To
facilitate the eventual removal of this macro it was added in a new header
file rather than to an existing header file.
This fixes#2995 and #3007.
After we've been hit by Large File Support problems several times in
the past week (which only occur on 32 bit platforms, which I don't
have), this is yet another attempt to fix the issue.
Added the "fd_util" library, which attempts to use the new thread-safe
Linux system calls pipe2(), accept4() and the options O_CLOEXEC,
SOCK_CLOEXEC. Without these, it falls back to FD_CLOEXEC, which is
not thread safe.
This is particularly important for the "pipe" output plugin (and
others, such as JACK/PulseAudio), because we were heavily leaking file
descriptors to child processes.
This updates the copyright header to all be the same, which is
pretty much an update of where to mail request for a copy of the GPL
and the years of the MPD project. This also puts all committers under
'The Music Player Project' umbrella. These entries should go
individually in the AUTHORS file, for consistancy.
The log file is duped to STDOUT_FILENO and STDERR_FILENO. No need to
keep another copy of it in out_fd all the time. We only need it once
once in setup_log_output().
The logging library currently has 3 constructor functions: initLog(),
open_log_files(), setup_log_output(), called in this order. Merged
the first two.
If the user wants the log files with a specific mode, he has to start
MPD with the correct umask. Don't hard-code that.
This fixes a bug: when log cycling failed, MPD would not restore the
old umask.
Make "secure" a log level different from "default". "secure" should be
right between "default" and "verbose". Map "default" to Glib's
"MESSAGE" log level.