modify notmuch_setup_command to return 1 if config file write fails.
authorJameson Graef Rollins <jrollins@finestructure.net>
Sun, 22 Nov 2009 21:58:35 +0000 (16:58 -0500)
committerCarl Worth <cworth@cworth.org>
Thu, 26 Nov 2009 03:24:27 +0000 (19:24 -0800)
This fixes a small bug in notmuch_setup_command such that it returned
OK and output the setup message footer even if the config file write
step failed.

notmuch-setup.c

index d06fbf80e6aac2e41e80f13abcbf7606f92a9440..5ec176d372a74e9b65c31846dc33fbe7ed95d22c 100644 (file)
@@ -156,10 +156,11 @@ notmuch_setup_command (unused (void *ctx),
        notmuch_config_set_database_path (config, absolute_path);
     }
 
-    notmuch_config_save (config);
-
-    if (is_new)
-       welcome_message_post_setup ();
-
-    return 0;
+    if (! notmuch_config_save (config)) {
+       if (is_new)
+         welcome_message_post_setup ();
+       return 0;
+    } else {
+       return 1;
+    }
 }