mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 20:38:08 +01:00
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.
This commit is contained in:
parent
f43990ce13
commit
f41a35e292
1 changed files with 6 additions and 3 deletions
|
@ -186,7 +186,6 @@ notmuch_config_open (void *ctx,
|
||||||
config->filename = talloc_strdup (config, filename);
|
config->filename = talloc_strdup (config, filename);
|
||||||
} else if ((notmuch_config_env = getenv ("NOTMUCH_CONFIG"))) {
|
} else if ((notmuch_config_env = getenv ("NOTMUCH_CONFIG"))) {
|
||||||
config->filename = talloc_strdup (config, notmuch_config_env);
|
config->filename = talloc_strdup (config, notmuch_config_env);
|
||||||
notmuch_config_env = NULL;
|
|
||||||
} else {
|
} else {
|
||||||
config->filename = talloc_asprintf (config, "%s/.notmuch-config",
|
config->filename = talloc_asprintf (config, "%s/.notmuch-config",
|
||||||
getenv ("HOME"));
|
getenv ("HOME"));
|
||||||
|
@ -206,8 +205,12 @@ notmuch_config_open (void *ctx,
|
||||||
&error))
|
&error))
|
||||||
{
|
{
|
||||||
/* We are capable of dealing with a non-existent configuration
|
/* We are capable of dealing with a non-existent configuration
|
||||||
* file, so be silent about that. */
|
* file, so be silent about that (unless the user had set a
|
||||||
if (!(error->domain == G_FILE_ERROR &&
|
* non-default configuration file with the NOTMUCH_CONFIG
|
||||||
|
* variable)
|
||||||
|
*/
|
||||||
|
if (notmuch_config_env ||
|
||||||
|
!(error->domain == G_FILE_ERROR &&
|
||||||
error->code == G_FILE_ERROR_NOENT))
|
error->code == G_FILE_ERROR_NOENT))
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Error reading configuration file %s: %s\n",
|
fprintf (stderr, "Error reading configuration file %s: %s\n",
|
||||||
|
|
Loading…
Reference in a new issue