X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-config.c;h=6845e3c3db5d3af6f5a9d25f39d4eb8060a1e41a;hp=d9c2eb3fe65957917bef62bfab61dbe74da32a8a;hb=89fe006ca421142bfba0969c140b633ad520832c;hpb=58ed67992d0ec1fa505026105218fa449f7980b0 diff --git a/notmuch-config.c b/notmuch-config.c index d9c2eb3f..6845e3c3 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -456,10 +456,19 @@ notmuch_config_save (notmuch_config_t *config) /* Try not to overwrite symlinks. */ filename = realpath (config->filename, NULL); if (! filename) { - fprintf (stderr, "Error canonicalizing %s: %s\n", config->filename, - strerror (errno)); - g_free (data); - return 1; + if (errno == ENOENT) { + filename = strdup (config->filename); + if (! filename) { + fprintf (stderr, "Out of memory.\n"); + g_free (data); + return 1; + } + } else { + fprintf (stderr, "Error canonicalizing %s: %s\n", config->filename, + strerror (errno)); + g_free (data); + return 1; + } } if (! g_file_set_contents (filename, data, length, &error)) { @@ -695,7 +704,7 @@ _item_split (char *item, char **group, char **key) *group = item; - period = index (item, '.'); + period = strchr (item, '.'); if (period == NULL || *(period+1) == '\0') { fprintf (stderr, "Invalid configuration name: %s\n"