From 7d12838e4c4d97cdd2757a8a7e00df41098e9a73 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Tue, 21 Mar 2023 23:41:16 +0000 Subject: Don't try to close log file if the pointer was NULL. --- TODO | 6 +++++- config.c | 4 ++-- logging.c | 1 - 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 6b83957..ebbd5d4 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,7 @@ All the TODOs sprinkled throughout the code! Configurable rotation of replay and debug logs. -Automatic rotation of replay log along with debug log? +Automatic rotation of replay log along with debug log? Especially given that replay from before startup is not sent. Configurable timestamp format in logs. @@ -43,4 +43,8 @@ Connecting from irssi triggers doautoreplay() from "USER received" in message.c Use the line number based replay log reading method from lastspoke rather than the inefficient re-read + line offset method in time replays? (And potentially remove a bunch of code re-use.) +What happens with lastspoke when there was no lastspoke time? Potentially opt to fall back on time based. And/or add lastspoke + time? + Crash when requesting 30 hour replay. + +Crash efnet 21/03/2023 20:32:25, possibly on sendtoserver() after a series of trying/failing to reconnect to disconnceted/timed-out server (no socket fd?). diff --git a/config.c b/config.c index 483f88e..2ee47f5 100644 --- a/config.c +++ b/config.c @@ -100,7 +100,7 @@ int getconfstr(char *confname, char *filename, char* dest) { debugprint(DEBUG_FULL, "getconfstr(): returning '%s'.\n", dest); - // Close fine and return success + // Close file and return success fclose(fp); return 1; } @@ -201,7 +201,7 @@ int getconfarr(char *confname, char *filename, char dest[MAXCONFARR][MAXDATASIZE debugprint(DEBUG_FULL, "getconfarr(): returning '%s'.\n", dest[i]); } - // Close fine and return success (or 0 if no values found in an otherwise valid array) + // Close file and return success (or 0 if no values found in an otherwise valid array) fclose(fp); if (valuecount) { return 1; diff --git a/logging.c b/logging.c index a3eac5b..d0ad1a5 100644 --- a/logging.c +++ b/logging.c @@ -341,7 +341,6 @@ int logline(char *str, struct ircdstate *ircdstate, char *basedir, int type) { if (fp == NULL) { debugprint(DEBUG_CRIT, "error: could not open log file '%s' for writing.\n", filename); printf("error: could not open log file '%s' for writing.\n", filename); - fclose(fp); return 0; } -- cgit v1.2.3