aboutsummaryrefslogtreecommitdiff
path: root/src/event_pipe.c
diff options
context:
space:
mode:
authorThomas Jansen <mithi@mithi.net>2010-09-25 15:00:43 +0200
committerThomas Jansen <mithi@mithi.net>2010-09-25 15:00:43 +0200
commit28bcb8bdf568875eeea1349e39b7958d77c8fcc1 (patch)
tree17397be16e8067a48fd532a581081f68a1b17700 /src/event_pipe.c
parent9af9fd140032138894e4781caabee8a5a96edab8 (diff)
eliminate g_error() usage
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.
Diffstat (limited to 'src/event_pipe.c')
-rw-r--r--src/event_pipe.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/event_pipe.c b/src/event_pipe.c
index 286256f9..5b519984 100644
--- a/src/event_pipe.c
+++ b/src/event_pipe.c
@@ -20,6 +20,7 @@
#include "config.h"
#include "event_pipe.h"
#include "fd_util.h"
+#include "mpd_error.h"
#include <stdbool.h>
#include <assert.h>
@@ -68,7 +69,7 @@ main_notify_event(G_GNUC_UNUSED GIOChannel *source,
buffer, sizeof(buffer),
&bytes_read, &error);
if (status == G_IO_STATUS_ERROR)
- g_error("error reading from pipe: %s", error->message);
+ MPD_ERROR("error reading from pipe: %s", error->message);
bool events[PIPE_EVENT_MAX];
g_mutex_lock(event_pipe_mutex);
@@ -91,7 +92,7 @@ void event_pipe_init(void)
ret = pipe_cloexec_nonblock(event_pipe);
if (ret < 0)
- g_error("Couldn't open pipe: %s", strerror(errno));
+ MPD_ERROR("Couldn't open pipe: %s", strerror(errno));
#ifndef G_OS_WIN32
channel = g_io_channel_unix_new(event_pipe[0]);
@@ -150,7 +151,7 @@ void event_pipe_emit(enum pipe_event event)
w = write(event_pipe[1], "", 1);
if (w < 0 && errno != EAGAIN && errno != EINTR)
- g_error("error writing to pipe: %s", strerror(errno));
+ MPD_ERROR("error writing to pipe: %s", strerror(errno));
}
void event_pipe_emit_fast(enum pipe_event event)