summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-09-12 22:51:14 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-09-12 22:51:14 +0100
commit5d0ea0d04b694ab1e5e83009bcb8a493e1f9a341 (patch)
tree759e7f425fdaefa2b10163ea8684e5345bd04431
parent820315c76b25471be9d3d609289024014d76506d (diff)
Don't try to fclose() the replay log file if fopen() returned NULL.
-rw-r--r--replay.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/replay.c b/replay.c
index 654e170..7100116 100644
--- a/replay.c
+++ b/replay.c
@@ -190,9 +190,8 @@ int replaylines(int seconds, char *basedir) {
fp = fopen(filename, "r");
if (fp == NULL) {
- printf("error: could not open replay log '%s'.\n", filename);
+ debugprint(DEBUG_FULL, "error: could not open replay log '%s'.\n", filename);
// Assume the file just doesn't exist yet - TODO - Interpret error codes to see what happened.
- fclose(fp);
return 0;
}
@@ -241,7 +240,6 @@ int readreplayline(int seconds, int linenum, char *str, struct settings *setting
if (fp == NULL) {
debugprint(DEBUG_CRIT, "error: readreplayline(): could not open replay log '%s'.\n", filename);
- fclose(fp);
return 0;
}
@@ -305,9 +303,8 @@ int lastspokesecondsago(char *nick, char *basedir) {
fp = fopen(filename, "r");
if (fp == NULL) {
- printf("error: replaylineslastspoke(): could not open replay log '%s'.\n", filename);
+ debugprint(DEBUG_FULL, "error: replaylineslastspoke(): could not open replay log '%s'.\n", filename);
// Assume the file just doesn't exist yet - TODO - Interpret error codes to see what happened.
- fclose(fp);
return 0;
}
@@ -400,7 +397,6 @@ int writereplayline(char *str, char *basedir) {
if (fp == NULL) {
debugprint(DEBUG_CRIT, "error: could not open replay log '%s' for writing.\n", filename);
- fclose(fp);
return 0;
}