From 842b903eecc94b0cdf4a68241450116e2fe31f8e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 14 Jul 2014 11:24:42 +0200 Subject: [PATCH] conf: check_user_conf_dir() returns bool --- src/conf.c | 8 ++++---- src/conf.h | 5 ++++- src/screen_keydef.c | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/conf.c b/src/conf.c index 1f1f0bc..171a9ee 100644 --- a/src/conf.c +++ b/src/conf.c @@ -582,19 +582,19 @@ read_rc_file(char *filename) return 0; } -int +bool check_user_conf_dir(void) { char *directory = g_build_filename(g_get_home_dir(), "." PACKAGE, NULL); if (g_file_test(directory, G_FILE_TEST_IS_DIR)) { g_free(directory); - return 0; + return true; } - int retval = g_mkdir(directory, 0755); + bool success = g_mkdir(directory, 0755) == 0; g_free(directory); - return retval; + return success; } char * diff --git a/src/conf.h b/src/conf.h index a9503ad..03b67cc 100644 --- a/src/conf.h +++ b/src/conf.h @@ -17,7 +17,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -int check_user_conf_dir(void); +#include + +bool +check_user_conf_dir(void); char *build_user_conf_filename(void); char *build_system_conf_filename(void); diff --git a/src/screen_keydef.c b/src/screen_keydef.c index 164cf65..b947dd8 100644 --- a/src/screen_keydef.c +++ b/src/screen_keydef.c @@ -145,7 +145,7 @@ apply_keys(void) static int save_keys(void) { - if (check_user_conf_dir()) { + if (!check_user_conf_dir()) { screen_status_printf(_("Error: Unable to create directory ~/.ncmpc - %s"), strerror(errno)); screen_bell(); -- 2.30.2