aboutsummaryrefslogtreecommitdiffstats
path: root/src/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/src/log.c b/src/log.c
index 1510b29e9..8fa056cb2 100644
--- a/src/log.c
+++ b/src/log.c
@@ -44,17 +44,14 @@ static const char *log_charset;
static bool stdout_mode = true;
static int out_fd = -1;
-static int err_fd = -1;
static const char *out_filename;
-static const char *err_filename;
static void redirect_logs(void)
{
assert(out_fd >= 0);
- assert(err_fd >= 0);
if (dup2(out_fd, STDOUT_FILENO) < 0)
FATAL("problems dup2 stdout : %s\n", strerror(errno));
- if (dup2(err_fd, STDERR_FILENO) < 0)
+ if (dup2(out_fd, STDERR_FILENO) < 0)
FATAL("problems dup2 stderr : %s\n", strerror(errno));
}
@@ -71,8 +68,6 @@ mpd_log_func(const gchar *log_domain,
G_GNUC_UNUSED GLogLevelFlags log_level,
const gchar *message, G_GNUC_UNUSED gpointer user_data)
{
- FILE *file = log_level <= G_LOG_LEVEL_WARNING
- ? stderr : stdout;
char *converted;
if (log_level > (int)log_threshold)
@@ -90,7 +85,7 @@ mpd_log_func(const gchar *log_domain,
if (log_domain == NULL)
log_domain = "";
- fprintf(file, "%s%s%s%s",
+ fprintf(stderr, "%s%s%s%s",
stdout_mode ? "" : log_date(),
log_domain, *log_domain == 0 ? "" : ": ",
message);
@@ -106,9 +101,6 @@ void initLog(bool verbose)
g_log_set_default_handler(mpd_log_func, NULL);
- /* unbuffer stdout, stderr is unbuffered by default, leave it */
- setvbuf(stdout, (char *)NULL, _IONBF, 0);
-
if (verbose) {
log_threshold = G_LOG_LEVEL_DEBUG;
return;
@@ -143,13 +135,6 @@ void open_log_files(bool use_stdout)
FATAL("problem opening log file \"%s\" (config line %i) for "
"writing\n", param->value, param->line);
- param = parseConfigFilePath(CONF_ERROR_FILE, 1);
- err_filename = param->value;
- err_fd = open(err_filename, O_CREAT | O_WRONLY | O_APPEND, 0666);
- if (err_fd < 0)
- FATAL("problem opening error file \"%s\" (config line %i) for "
- "writing\n", param->value, param->line);
-
umask(prev);
}
@@ -198,7 +183,6 @@ int cycle_log_files(void)
if (stdout_mode)
return 0;
assert(out_filename);
- assert(err_filename);
DEBUG("Cycling log files...\n");
close_log_files();
@@ -211,12 +195,6 @@ int cycle_log_files(void)
return -1;
}
- err_fd = open(err_filename, O_CREAT | O_WRONLY | O_APPEND, 0666);
- if (err_fd < 0) {
- ERROR("error re-opening error file: %s\n", err_filename);
- return -1;
- }
-
umask(prev);
redirect_logs();
@@ -229,8 +207,6 @@ void close_log_files(void)
if (stdout_mode)
return;
assert(out_fd >= 0);
- assert(err_fd >= 0);
close(out_fd);
- close(err_fd);
}