diff --git a/src/lib/cache.c b/src/lib/cache.c index 80ec03d..359622c 100644 --- a/src/lib/cache.c +++ b/src/lib/cache.c @@ -57,14 +57,17 @@ int cache_process() { } cache = shm_rw; - if (mkdir("/var/necronda-server/", 0755) < 0) { - if (errno != EEXIST) { - fprintf(stderr, ERR_STR "Unable to create directory '/var/necronda-server/': %s" CLR_STR "\n", strerror(errno)); - return -3; - } + if (mkdir("/var/necronda/", 0755) < 0 && errno != EEXIST) { + fprintf(stderr, ERR_STR "Unable to create directory '/var/necronda/': %s" CLR_STR "\n", strerror(errno)); + return -3; } - FILE *cache_file = fopen("/var/necronda-server/cache", "rb"); + if (mkdir("/var/necronda/server/", 0755) < 0 && errno != EEXIST) { + fprintf(stderr, ERR_STR "Unable to create directory '/var/necronda/server/': %s" CLR_STR "\n", strerror(errno)); + return -3; + } + + FILE *cache_file = fopen("/var/necronda/server/cache", "rb"); if (cache_file != NULL) { fread(cache, sizeof(cache_entry), CACHE_ENTRIES, cache_file); fclose(cache_file); @@ -191,7 +194,7 @@ int cache_process() { if (cache_changed) { cache_changed = 0; - cache_file = fopen("/var/necronda-server/cache", "wb"); + cache_file = fopen("/var/necronda/server/cache", "wb"); if (cache_file == NULL) { fprintf(stderr, ERR_STR "Unable to open cache file: %s" CLR_STR "\n", strerror(errno)); free(buf); diff --git a/src/lib/cache.h b/src/lib/cache.h index 14e6c84..3d5583b 100644 --- a/src/lib/cache.h +++ b/src/lib/cache.h @@ -18,10 +18,6 @@ # define CACHE_MAGIC_FILE "/usr/share/file/misc/magic.mgc" #endif -#ifndef DEFAULT_CONFIG_FILE -# define DEFAULT_CONFIG_FILE "/etc/necronda-server/necronda-server.conf" -#endif - typedef struct { char filename[256]; diff --git a/src/lib/config.h b/src/lib/config.h index a75ac62..b7aa7e5 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -17,6 +17,11 @@ #define CONFIG_TYPE_LOCAL 1 #define CONFIG_TYPE_REVERSE_PROXY 2 +#ifndef DEFAULT_CONFIG_FILE +# define DEFAULT_CONFIG_FILE "/etc/necronda/server.conf" +#endif + + typedef struct { int type; char name[256];