Code

conf: check_user_conf_dir() returns bool
authorMax Kellermann <max@duempel.org>
Mon, 14 Jul 2014 09:24:42 +0000 (11:24 +0200)
committerMax Kellermann <max@duempel.org>
Mon, 14 Jul 2014 09:24:42 +0000 (11:24 +0200)
src/conf.c
src/conf.h
src/screen_keydef.c

index 1f1f0bc39f0754b3cd847b2f327ffc6b04ab85db..171a9ee49d57d073f76e6f491c58efb5d8f126e7 100644 (file)
@@ -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 *
index a9503ad3821834d2432577263d96744890c6d0a4..03b67cc93ae34642469ad0d9761022a8ef4bd4f5 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-int check_user_conf_dir(void);
+#include <stdbool.h>
+
+bool
+check_user_conf_dir(void);
 
 char *build_user_conf_filename(void);
 char *build_system_conf_filename(void);
index 164cf6565822adc0d2f8f74df3b6748b76e435cd..b947dd8f0ebf022634efedfa9781bb4fa5bfe94f 100644 (file)
@@ -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();