summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-05-29 21:05:31 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-05-29 21:05:31 +0100
commitc5a9bc507e9724090a63cdfb3b6df13a0ff74582 (patch)
tree744786fb38a68342fa1ded53e263ff0c2813c134
parent92d106733468893d921dc678296a6716ddf979a4 (diff)
Ensure writes to file are unformatted strings.
-rw-r--r--TODO8
-rw-r--r--config.c2
-rw-r--r--logging.c2
-rw-r--r--replay.c2
4 files changed, 9 insertions, 5 deletions
diff --git a/TODO b/TODO
index 419dd3d..20dff69 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,3 @@
-Allow debugging to file as well as to screen.
-
Add various auto replay options:
- All logs since the final client disconnected
- All logs since the most recent client connect/disconnect
@@ -12,3 +10,9 @@ Might need to #include <limits.h> in blabouncer.c to make some operating systems
Send a PING to the server before assuming a timeout is definite.
Implement daemon (background) mode.
+
+Implement BLABOUNCER EXIT command.
+
+Some text gets written to previous debug.txt upon startup (getconfstr() output).
+
+Don't exit if there's a failure to read the replay log file/line.
diff --git a/config.c b/config.c
index dcbba42..480d567 100644
--- a/config.c
+++ b/config.c
@@ -229,7 +229,7 @@ int createconfigfile(char *filename) {
"debug = \"1\"\n";
// Write complete string to file
- if ((fprintf(fp, string)) < 0) {
+ if ((fprintf(fp, "%s", string)) < 0) {
printf("error: could not write to replay log file.\n");
exit(1);
}
diff --git a/logging.c b/logging.c
index dcadb26..944dc91 100644
--- a/logging.c
+++ b/logging.c
@@ -203,7 +203,7 @@ int logline(char *str, char *ournick, char *basedir, int type) {
debugprint("logline(): Complete log string to write: '%s', length '%ld'.\n", line, strlen(line));
// Write complete line to file
- if ((bytes = fprintf(fp, line)) < 0) {
+ if ((bytes = fprintf(fp, "%s", line)) < 0) {
printf("error: could not write to log file.\n");
exit(1);
}
diff --git a/replay.c b/replay.c
index b0b4b26..410463b 100644
--- a/replay.c
+++ b/replay.c
@@ -273,7 +273,7 @@ int writereplayline(char *str, char *basedir) {
debugprint("Complete replay log string to write: '%s', length '%ld'.\n", line, strlen(line));
// Write complete line to file
- if ((bytes = fprintf(fp, line)) < 0) {
+ if ((bytes = fprintf(fp, "%s", line)) < 0) {
printf("error: could not write to replay log file.\n");
exit(1);
}