X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-config.c;h=cc05f6c414971019b9d799cd3fc81874079a57b4;hp=fc65d6b00cb1112ea59718798a3cdd2dc31be5d9;hb=40ff2ab62a4b1b4a5fad4cc8c102afb09135b9ca;hpb=91d1d3f043b82d5f3f8c04f2db71a829a7406131 diff --git a/notmuch-config.c b/notmuch-config.c index fc65d6b0..cc05f6c4 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -186,7 +186,6 @@ notmuch_config_open (void *ctx, config->filename = talloc_strdup (config, filename); } else if ((notmuch_config_env = getenv ("NOTMUCH_CONFIG"))) { config->filename = talloc_strdup (config, notmuch_config_env); - notmuch_config_env = NULL; } else { config->filename = talloc_asprintf (config, "%s/.notmuch-config", getenv ("HOME")); @@ -206,8 +205,12 @@ notmuch_config_open (void *ctx, &error)) { /* We are capable of dealing with a non-existent configuration - * file, so be silent about that. */ - if (!(error->domain == G_FILE_ERROR && + * file, so be silent about that (unless the user had set a + * non-default configuration file with the NOTMUCH_CONFIG + * variable) + */ + if (notmuch_config_env || + !(error->domain == G_FILE_ERROR && error->code == G_FILE_ERROR_NOENT)) { fprintf (stderr, "Error reading configuration file %s: %s\n", @@ -317,9 +320,11 @@ notmuch_config_save (notmuch_config_t *config) fprintf (stderr, "Error saving configuration to %s: %s\n", config->filename, error->message); g_error_free (error); + g_free (data); return 1; } + g_free (data); return 0; }