From 409ee38b4263411d1d5de769bc9ead70a059c838 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 29 Dec 2008 17:29:23 +0100 Subject: state_file: use GLib logging --- src/state_file.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src') 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 #include +#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); } -- cgit v1.2.3