]> git.notmuchmail.org Git - notmuch/commitdiff
lib: return NULL from n_d_get_default_indexopts on error
authorDavid Bremner <david@tethera.net>
Sat, 1 Aug 2020 12:25:50 +0000 (09:25 -0300)
committerDavid Bremner <david@tethera.net>
Mon, 3 Aug 2020 23:45:58 +0000 (20:45 -0300)
This is a rare and probably serious programming error, so better not
to silently return a default value.

lib/indexopts.c
lib/notmuch.h
test/T562-lib-database.sh

index 1e8d180e8af7bdf54d784b46876e5b843f111c62..82a0026f0d46b47d46e94407d2271df978bd90db 100644 (file)
@@ -32,7 +32,7 @@ notmuch_database_get_default_indexopts (notmuch_database_t *db)
     char *decrypt_policy;
     notmuch_status_t err = notmuch_database_get_config (db, "index.decrypt", &decrypt_policy);
     if (err)
-       return ret;
+       return NULL;
 
     if (decrypt_policy) {
        if ((! (strcasecmp (decrypt_policy, "true"))) ||
index f9e9cc413bcbe3daddde0431cbc07dc6f590a149..aaf92470fb67154313182ca76843f9fcfb6afba9 100644 (file)
@@ -2320,6 +2320,7 @@ notmuch_config_list_destroy (notmuch_config_list_t *config_list);
  * added to the index.  At the moment it is a featureless stub.
  *
  * @since libnotmuch 5.1 (notmuch 0.26)
+ * @retval NULL in case of error
  */
 notmuch_indexopts_t *
 notmuch_database_get_default_indexopts (notmuch_database_t *db);
index 32fda72e26e6b76c2ac2db9b1077a93a7f3da062..ce62eaa8af5d4756587c6d3ae0969c8fe02677be 100755 (executable)
@@ -373,7 +373,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "get indexopts from closed database"
-test_subtest_known_broken
 cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
     {
         notmuch_indexopts_t *result;