From eda707444682c138f7b182c94198ae04bb8b84bd Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Wed, 12 Oct 2022 17:22:53 +1300 Subject: [PATCH 04/10] Fix readlink() return value on Windows. It accidentally returned a value that counted the trailing nul terminator. This is an ancient bug, but it's benign. --- src/port/dirmod.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/port/dirmod.c b/src/port/dirmod.c index 51c9bded8f..5881024929 100644 --- a/src/port/dirmod.c +++ b/src/port/dirmod.c @@ -359,6 +359,9 @@ pgreadlink(const char *path, char *buf, size_t size) return -1; } + /* r includes the nul terminator */ + r -= 1; + /* * If the path starts with "\??\", which it will do in most (all?) cases, * strip those out. -- 2.37.3