X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-search.c;h=cde97351b493514228ca7e2df69c5d5a65ca1eac;hp=f7f9e70c041d746df56a6bc0386bc06358a67765;hb=f379aa52845f5594aa6cc2e7cf131d5f57202bbf;hpb=2ce25b93a72b4a8d6daa5321f9ef7df0772a789f diff --git a/notmuch-search.c b/notmuch-search.c index f7f9e70c..cde97351 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -129,7 +129,8 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) if (config == NULL) return 1; - notmuch = notmuch_database_open (notmuch_config_get_database_path (config)); + notmuch = notmuch_database_open (notmuch_config_get_database_path (config), + NOTMUCH_DATABASE_MODE_READONLY); if (notmuch == NULL) return 1; @@ -138,6 +139,10 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) fprintf (stderr, "Out of memory.\n"); return 1; } + if (*query_str == '\0') { + fprintf (stderr, "Error: notmuch search requires at least one search term.\n"); + return 1; + } query = notmuch_query_create (notmuch, query_str); if (query == NULL) {