diff options
author | Luke Bratch <luke@bratch.co.uk> | 2019-09-12 22:51:14 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2019-09-12 22:51:14 +0100 |
commit | 5d0ea0d04b694ab1e5e83009bcb8a493e1f9a341 (patch) | |
tree | 759e7f425fdaefa2b10163ea8684e5345bd04431 | |
parent | 820315c76b25471be9d3d609289024014d76506d (diff) |
Don't try to fclose() the replay log file if fopen() returned NULL.
-rw-r--r-- | replay.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -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; } |