diff options
author | Max Kellermann <max@duempel.org> | 2009-09-24 21:40:07 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-09-24 21:40:07 +0200 |
commit | 06d5d4b03ec446b9eb7a7351c32ef2fdca29d3c8 (patch) | |
tree | ff7a44852afe108b5d7a89de1a9e8a44f7f969fe /src/cmdline.c | |
parent | f3739a73af02a0152e842f2451358aa7aa962c1e (diff) | |
download | mpd-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 'src/cmdline.c')
-rw-r--r-- | src/cmdline.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/cmdline.c b/src/cmdline.c index 44b3ff507..9e3919152 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -152,21 +152,20 @@ parse_cmdline(int argc, char **argv, struct options *options, path2 = g_build_filename(g_get_home_dir(), USER_CONFIG_FILE_LOCATION2, NULL); if (g_file_test(path1, G_FILE_TEST_IS_REGULAR)) - config_read_file(path1); + ret = config_read_file(path1, error_r); else if (g_file_test(path2, G_FILE_TEST_IS_REGULAR)) - config_read_file(path2); + ret = config_read_file(path2, error_r); else if (g_file_test(SYSTEM_CONFIG_FILE_LOCATION, G_FILE_TEST_IS_REGULAR)) - config_read_file(SYSTEM_CONFIG_FILE_LOCATION); + ret = config_read_file(SYSTEM_CONFIG_FILE_LOCATION, + error_r); g_free(path1); g_free(path2); - return true; + return ret; } else if (argc == 2) { /* specified configuration file */ - config_read_file(argv[1]); - - return true; + return config_read_file(argv[1], error_r); } else { g_set_error(error_r, cmdline_quark(), 0, "too many arguments"); |