summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2023-08-01 23:57:07 +0100
committerLuke Bratch <luke@bratch.co.uk>2023-08-01 23:57:07 +0100
commit35b494cafe1e3ff1b278040999da09b061c82fbc (patch)
tree8423d172fffe55068d0f9916f251f237a67bc07c
parent3b2b776a1f3684429c5014b964db54737e662dda (diff)
Always close() the replay log file if it's been opened.
-rw-r--r--TODO9
-rw-r--r--replay.c4
2 files changed, 12 insertions, 1 deletions
diff --git a/TODO b/TODO
index 6bcc8d3..be5b2ac 100644
--- a/TODO
+++ b/TODO
@@ -40,7 +40,14 @@ Debug log ("checking client socket <i> out of <fdmax>") gets busy after fdmax ge
BLABOUNCER/stdin functions to add:
- List connected/authenticated clients
-KICK not handled.
+KICK not handled (temporary work in kick-support-20230409.diff)
+KICK:
+Sun Apr 9 03:35:31 2023: BOUNCER-SERVER RECEIVED: ':bbnick!bbuser@2a06:5844:e:551:0:0:0:1d KICK #bla12 bbounce2 :bbnick
+Sun Apr 9 03:35:31 2023: Server KICK: nick is NOT ours ('bbnick' vs 'bbounce2').
+PART:
+Sun Apr 9 04:16:09 2023: BOUNCER-SERVER RECEIVED: ':bbounce2!l_bratch@2a06:5844:e:551:0:0:0:1d PART #bla12 :Leaving
+Sun Apr 9 04:16:09 2023: Server PART: nick is ours ('bbounce2' vs 'bbounce2').
+^^Reminder, joining channels (and getting the nick list) seems to be broken right now (TG reminder).
Crash when requesting 30 hour replay.
diff --git a/replay.c b/replay.c
index cda8fb3..de11988 100644
--- a/replay.c
+++ b/replay.c
@@ -461,6 +461,7 @@ long lastspokelinenumber(char *nick, char *basedir) {
// Try to split
if ((token = strsep(&strcopy, " ")) == NULL) {
debugprint(DEBUG_CRIT, "lastspokelinenumber(): error splitting string on iteration '%d', returning -1!\n", i);
+ fclose(fp);
return -1;
}
// Copy into the token array (strlen + 1 to get the NULL terminator)
@@ -472,12 +473,14 @@ long lastspokelinenumber(char *nick, char *basedir) {
// Make sure there were at least three tokens
if (counter < 3) {
debugprint(DEBUG_CRIT, "lastspokelinenumber(): not enough tokens on line, only '%d', returning -1!\n", counter);
+ fclose(fp);
return -1;
}
// Make sure it started with a valid timestamp
int timestamp = gettimestamp(tokens[0]);
if (timestamp < 0) {
+ fclose(fp);
debugprint(DEBUG_CRIT, "lastspokelinenumber(): line didn't start with a timestamp, returning -1!\n", counter);
}
@@ -622,6 +625,7 @@ int doreplaylastspoke(int sourcefd, long linenumber, struct client *clients, str
snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Log replay complete.", ircdstate->ircnick);
sendtoclient(sourcefd, outgoingmsg, clients, settings, 0);
+ fclose(fp);
return 1;
}