summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2026-02-14 11:39:03 +0000
committerLuke Bratch <luke@bratch.co.uk>2026-02-14 11:39:03 +0000
commit36179e624e04fd44e462d87f54037c9c4fbc46b3 (patch)
tree0066754437b277b07f328c9efde9b3957d1c72d5
parent2a1d4b2e958de1581e9bda7b07b705b963e394a6 (diff)
Correct error handling and comment in createconfigfile().
-rw-r--r--TODO2
-rw-r--r--config.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/TODO b/TODO
index eb7bf2b..2164755 100644
--- a/TODO
+++ b/TODO
@@ -61,3 +61,5 @@ NickServ HELP with SA receiving full message in one go? e.g. oper 05/01/2025 10:
/NAMES doesn't show names in client.
Allow specifying time zone for timestamps in config.
+
+Use default configuration options and stderr warn if missing and where possible.
diff --git a/config.c b/config.c
index b2868b1..9957e19 100644
--- a/config.c
+++ b/config.c
@@ -279,7 +279,7 @@ int getconfint(char *confname, char *filename) {
}
// Create the default configuration file.
-// Return 1 on success, 0 on failure.
+// Return 0 on success, exits on failure.
int createconfigfile(char *filename) {
char *dirtmp;
char *dir;
@@ -438,7 +438,9 @@ int createconfigfile(char *filename) {
// Write complete string to file
if ((fprintf(fp, "%s", string)) < 0) {
- debugprint(DEBUG_CRIT, "error: could not write to replay log file.\n");
+ printf("Error writing default config file '%s'.\n", filename);
+ debugprint(DEBUG_CRIT, "Error writing default config file '%s'.\n", filename);
+ exit(1);
}
fclose(fp);