centralized filename calculation
[citadel.git] / citadel / control.c
index 6704c3edcbb91e91e32d9ef1550cac39936cee08..2260fa5617e716aec948d95edee1c1b509566206 100644 (file)
@@ -60,25 +60,13 @@ void get_control(void)
         */
        memset(&CitControl, 0, sizeof(struct CitControl));
        if (control_fp == NULL) {
-               control_fp = fopen(
-#ifndef HAVE_DATA_DIR
-                                                  "."
-#else
-                                                  DATA_DIR
-#endif
-                                                  "/citadel.control", "rb+");
+               control_fp = fopen(file_citadel_control, "rb+");
                if (control_fp != NULL) {
                        fchown(fileno(control_fp), config.c_ctdluid, -1);
                }
        }
        if (control_fp == NULL) {
-               control_fp = fopen(
-#ifndef HAVE_DATA_DIR
-                                                  "."
-#else
-                                                  DATA_DIR
-#endif
-                                                  "/citadel.control", "wb+");
+               control_fp = fopen(file_citadel_control, "wb+");
                if (control_fp != NULL) {
                        fchown(fileno(control_fp), config.c_ctdluid, -1);
                        memset(&CitControl, 0, sizeof(struct CitControl));
@@ -88,8 +76,9 @@ void get_control(void)
                }
        }
        if (control_fp == NULL) {
-               lprintf(CTDL_ALERT, "ERROR opening citadel.control: %s\n",
-                       strerror(errno));
+               lprintf(CTDL_ALERT, "ERROR opening %s: %s\n",
+                               file_citadel_control,
+                               strerror(errno));
                return;
        }