diff options
author | Max Kellermann <max@duempel.org> | 2009-01-03 14:53:23 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-03 14:53:23 +0100 |
commit | dcff29e5aa18d8957635553753c4b4ddd730d790 (patch) | |
tree | 903e2a67e665d777134b53cb5443a3e5505c41d0 /src/state_file.c | |
parent | 2064e8ac4cb4c7b7c69042e6dc1715c18777b983 (diff) | |
download | mpd-dcff29e5aa18d8957635553753c4b4ddd730d790.tar.gz mpd-dcff29e5aa18d8957635553753c4b4ddd730d790.tar.xz mpd-dcff29e5aa18d8957635553753c4b4ddd730d790.zip |
state_file: errors are non-fatal in read_state_file()
If the state file cannot be read, for whatever reason, don't abort
MPD. The state file isn't _that_ important.
Diffstat (limited to 'src/state_file.c')
-rw-r--r-- | src/state_file.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/state_file.c b/src/state_file.c index 53a6a711b..7666cc134 100644 --- a/src/state_file.c +++ b/src/state_file.c @@ -26,7 +26,6 @@ #include <glib.h> #include <string.h> -#include <sys/stat.h> #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "state_file" @@ -74,24 +73,18 @@ void write_state_file(void) void read_state_file(void) { - struct stat st; unsigned int i; FILE *fp; get_state_file_path(); if (!sfpath) return; - if (stat(sfpath, &st) < 0) { - g_debug("failed to stat %s: %s", sfpath, strerror(errno)); - return; - } - if (!S_ISREG(st.st_mode)) - g_error("\"%s\" is not a regular file", sfpath); while (!(fp = fopen(sfpath, "r")) && errno == EINTR); if (G_UNLIKELY(!fp)) { - g_error("failed to open %s: %s", - sfpath, strerror(errno)); + g_warning("failed to open %s: %s", + sfpath, strerror(errno)); + return; } for (i = 0; i < ARRAY_SIZE(sf_callbacks); i++) { sf_callbacks[i].reader(fp); @@ -100,9 +93,3 @@ void read_state_file(void) while(fclose(fp) && errno == EINTR) /* nothing */; } - -void G_GNUC_NORETURN state_file_fatal(void) -{ - g_error("failed to parse %s", sfpath); -} - |