summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-07-10 23:02:12 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-07-10 23:02:12 +0100
commit726496b1711117d113b8da971edf8114db07ab06 (patch)
treebeb1e13d95eadbbe22bb02ea0b42e9e62a211890
parente413787a5dbf0b4e377935d2192bc00cf9830cb8 (diff)
Include the file extension when checking for log filename length.
-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;
}