aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-12-29 17:29:23 +0100
committerMax Kellermann <max@duempel.org>2008-12-29 17:29:23 +0100
commit409ee38b4263411d1d5de769bc9ead70a059c838 (patch)
treecf321e1f1d2410662f1f44443093be488ab5fc9b /src
parentd4018c9966a75e293827fc0252ceb8326763e8b1 (diff)
downloadmpd-409ee38b4263411d1d5de769bc9ead70a059c838.tar.gz
mpd-409ee38b4263411d1d5de769bc9ead70a059c838.tar.xz
mpd-409ee38b4263411d1d5de769bc9ead70a059c838.zip
state_file: use GLib logging
Diffstat (limited to '')
-rw-r--r--src/state_file.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/state_file.c b/src/state_file.c
index 1a3e05a77..53a6a711b 100644
--- a/src/state_file.c
+++ b/src/state_file.c
@@ -19,7 +19,6 @@
#include "../config.h"
#include "state_file.h"
#include "conf.h"
-#include "log.h"
#include "audio.h"
#include "playlist.h"
#include "utils.h"
@@ -29,6 +28,9 @@
#include <string.h>
#include <sys/stat.h>
+#undef G_LOG_DOMAIN
+#define G_LOG_DOMAIN "state_file"
+
static struct _sf_cb {
void (*reader)(FILE *);
void (*writer)(FILE *);
@@ -59,8 +61,8 @@ void write_state_file(void)
return;
fp = fopen(sfpath, "w");
if (G_UNLIKELY(!fp)) {
- ERROR("problems opening state file \"%s\" for writing: %s\n",
- sfpath, strerror(errno));
+ g_warning("failed to create %s: %s",
+ sfpath, strerror(errno));
return;
}
@@ -80,16 +82,16 @@ void read_state_file(void)
if (!sfpath)
return;
if (stat(sfpath, &st) < 0) {
- DEBUG("failed to stat state file: %s\n", sfpath);
+ g_debug("failed to stat %s: %s", sfpath, strerror(errno));
return;
}
if (!S_ISREG(st.st_mode))
- FATAL("state file \"%s\" is not a regular file\n", sfpath);
+ g_error("\"%s\" is not a regular file", sfpath);
while (!(fp = fopen(sfpath, "r")) && errno == EINTR);
if (G_UNLIKELY(!fp)) {
- FATAL("problems opening state file \"%s\" for reading: %s\n",
- sfpath, strerror(errno));
+ g_error("failed to open %s: %s",
+ sfpath, strerror(errno));
}
for (i = 0; i < ARRAY_SIZE(sf_callbacks); i++) {
sf_callbacks[i].reader(fp);
@@ -101,6 +103,6 @@ void read_state_file(void)
void G_GNUC_NORETURN state_file_fatal(void)
{
- FATAL("error parsing state file \"%s\"\n", sfpath);
+ g_error("failed to parse %s", sfpath);
}