X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-config.c;h=a564bcae362f6b0b9304ade15e580faa67f84437;hp=db487dbe828ba808b6c3223a8d33df581864d74f;hb=eab18a61a9831d73f22b058d9003a683ef6c6462;hpb=f92342cb76fa3e1fa2f1c2e727f8ddf1a5c21b7d diff --git a/notmuch-config.c b/notmuch-config.c index db487dbe..a564bcae 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -283,16 +283,22 @@ notmuch_config_open (void *ctx, G_KEY_FILE_KEEP_COMMENTS, &error)) { - /* If create_new is true, then the caller is prepared for a - * default configuration file in the case of FILE NOT - * FOUND. Otherwise, any read failure is an error. - */ - if (create_new && - error->domain == G_FILE_ERROR && - error->code == G_FILE_ERROR_NOENT) - { - g_error_free (error); - config->is_new = TRUE; + if (error->domain == G_FILE_ERROR && error->code == G_FILE_ERROR_NOENT) { + /* If create_new is true, then the caller is prepared for a + * default configuration file in the case of FILE NOT + * FOUND. + */ + if (create_new) { + g_error_free (error); + config->is_new = TRUE; + } else { + fprintf (stderr, "Configuration file %s not found.\n" + "Try running 'notmuch setup' to create a configuration.\n", + config->filename); + talloc_free (config); + g_error_free (error); + return NULL; + } } else {