aboutsummaryrefslogtreecommitdiffstats
path: root/test/read_conf.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-09-24 21:40:07 +0200
committerMax Kellermann <max@duempel.org>2009-09-24 21:40:07 +0200
commit06d5d4b03ec446b9eb7a7351c32ef2fdca29d3c8 (patch)
treeff7a44852afe108b5d7a89de1a9e8a44f7f969fe /test/read_conf.c
parentf3739a73af02a0152e842f2451358aa7aa962c1e (diff)
downloadmpd-06d5d4b03ec446b9eb7a7351c32ef2fdca29d3c8.tar.gz
mpd-06d5d4b03ec446b9eb7a7351c32ef2fdca29d3c8.tar.xz
mpd-06d5d4b03ec446b9eb7a7351c32ef2fdca29d3c8.zip
conf: handle fatal errors with GError
Don't call g_error(), which will abort the process and dump core. This patch does not affect all the config_get_X() functions. These need some more refactoring.
Diffstat (limited to 'test/read_conf.c')
-rw-r--r--test/read_conf.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/read_conf.c b/test/read_conf.c
index 286ec2c77..92fcbba99 100644
--- a/test/read_conf.c
+++ b/test/read_conf.c
@@ -37,6 +37,8 @@ my_log_func(G_GNUC_UNUSED const gchar *log_domain,
int main(int argc, char **argv)
{
const char *path, *name, *value;
+ GError *error = NULL;
+ bool success;
int ret;
if (argc != 3) {
@@ -50,7 +52,12 @@ int main(int argc, char **argv)
g_log_set_default_handler(my_log_func, NULL);
config_global_init();
- config_read_file(path);
+ success = config_read_file(path, &error);
+ if (!success) {
+ g_printerr("%s:", error->message);
+ g_error_free(error);
+ return 1;
+ }
value = config_get_string(name, NULL);
if (value != NULL) {