summaryrefslogtreecommitdiff
path: root/blabouncer.c
diff options
context:
space:
mode:
Diffstat (limited to 'blabouncer.c')
-rw-r--r--blabouncer.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/blabouncer.c b/blabouncer.c
index efb2474..e5637cf 100644
--- a/blabouncer.c
+++ b/blabouncer.c
@@ -2212,6 +2212,11 @@ int main(int argc, char *argv[]) {
exit(1);
}
+ // Is the base directory set? If not, use the default.
+ if (!getconfstr("basedir", settings.conffile, settings.basedir)) {
+ snprintf(settings.basedir, PATH_MAX, "%s/.blabouncer/", getenv("HOME"));
+ }
+
// Should the bouncer use TLS for the IRC server?
settings.servertls = getconfint("servertls", settings.conffile);
@@ -2223,21 +2228,22 @@ int main(int argc, char *argv[]) {
// What is the certificate file path?
if (!getconfstr("certfile", settings.conffile, settings.certfile)) {
// If none provided, set to default
- snprintf(settings.certfile, PATH_MAX, "%s/.blabouncer/cert.pem", getenv("HOME"));
+ if (!snprintf(settings.certfile, PATH_MAX, "%s/cert.pem", settings.basedir)) {
+ fprintf(stderr, "Error while preparing default certfile location!\n");
+ exit(1);
+ }
}
// What is the certificate key file path?
if (!getconfstr("keyfile", settings.conffile, settings.keyfile)) {
// If none provided, set to default
- snprintf(settings.keyfile, PATH_MAX, "%s/.blabouncer/key.pem", getenv("HOME"));
+ if (!snprintf(settings.keyfile, PATH_MAX, "%s/key.pem", settings.basedir)) {
+ fprintf(stderr, "Error while preparing default certfile location!\n");
+ exit(1);
+ }
}
}
- // Is the base directory set? If not, use the default.
- if (!getconfstr("basedir", settings.conffile, settings.basedir)) {
- snprintf(settings.basedir, PATH_MAX, "%s/.blabouncer/", getenv("HOME"));
- }
-
// Make sure the base directory exists
struct stat st = {0};
if (stat(settings.basedir, &st) == -1) {