diff options
author | Carl Worth <cworth@cworth.org> | 2010-04-21 15:54:03 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-04-21 15:54:03 -0700 |
commit | f41a35e2923b0b3ef2f66e91cd30e20b4c1a336a (patch) | |
tree | 5837125c3d261c04ed367fbb53b6a265f9cca821 /notmuch-config.c | |
parent | f43990ce134d838cdb2cdd5d0752a602e81cfdd9 (diff) |
notmuch: Abort if specified configuration file is not found.
When there is no configuration file at all, (and none specified),
notmuch works correctly by assuming correct default values. But when
the user specifies a configuration file (with the NOTMUCH_CONFIG
environment variable) and that file doesn't exist, then notmuch should
aboirt and let the user know about the problem.
Diffstat (limited to 'notmuch-config.c')
-rw-r--r-- | notmuch-config.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/notmuch-config.c b/notmuch-config.c index 95430db1..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", |