]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-config.c
cli: initialize quiet variable in compact
[notmuch] / notmuch-config.c
index d9c2eb3fe65957917bef62bfab61dbe74da32a8a..6845e3c3db5d3af6f5a9d25f39d4eb8060a1e41a 100644 (file)
@@ -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"