* Applied a patch sent in by Wilfried Goesgens which allows the various
[citadel.git] / citadel / config.c
index 8562f3472f213f4e4ddbe2113d227464c38a60e0..996118816cbe14086861d8365a051465fc4ae085 100644 (file)
@@ -45,7 +45,13 @@ void get_config(void) {
                        strerror(errno));
                exit(1);
        }
-       cfp = fopen("citadel.config", "rb");
+       cfp = fopen(
+#ifndef HAVE_ETC_DIR
+                               "."
+#else
+                               ETC_DIR
+#endif
+                               "/citadel.config", "rb");
        if (cfp == NULL) {
                fprintf(stderr, "This program could not be started.\n"
                        "Unable to open %s/citadel.config\n"
@@ -116,7 +122,13 @@ void put_config(void)
 {
        FILE *cfp;
 
-       if ((cfp = fopen("citadel.config", "rb+")) == NULL)
+       if ((cfp = fopen(
+#ifndef HAVE_ETC_DIR
+                                        "."
+#else
+                                        ETC_DIR
+#endif
+                                        "/citadel.config", "rb+")) == NULL)
                perror("citadel.config");
        else {
                fwrite((char *) &config, sizeof(struct config), 1, cfp);