summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--logging.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/logging.c b/logging.c
index 6e8d9b7..c3271fe 100644
--- a/logging.c
+++ b/logging.c
@@ -84,8 +84,8 @@ int logline(char *str, char *ournick, char *basedir, int type) {
// Remove unsafe characters (assuming POSIX, just strip "/" and replace with "_")
replacechar(from, '/', '_');
replacechar(to, '/', '_');
- // Ensure filename wouldn't be too long
- if (strlen(from) > NAME_MAX || strlen(to) > NAME_MAX) {
+ // Ensure filename wouldn't be too long (+ 4 for ".log")
+ if (strlen(from) + 4 > NAME_MAX || strlen(to) + 4 > NAME_MAX) {
debugprint(DEBUG_CRIT, "Filename would be too long if logging either '%s' or '%s', returning!\n", from, to);
return 0;
}