summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Munro2022-10-25 02:13:52 +0000
committerThomas Munro2022-10-25 02:13:52 +0000
commit4650036f5ab81c93e3b6ed549ef672a325b79705 (patch)
tree011d5502765fd586853caee1ac3236e186ec7e29
parent359d601095ce2361bad50f9f8b0bcfe4da1eb886 (diff)
Fix readlink() return value on Windows.
Ancient bug noticed while working on a test suite for these functions. Discussion: https://postgr.es/m/CA%2BhUKG%2BajSQ_8eu2AogTncOnZ5me2D-Cn66iN_-wZnRjLN%2Bicg%40mail.gmail.com
-rw-r--r--src/port/dirmod.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/port/dirmod.c b/src/port/dirmod.c
index 51c9bded8f..398787360a 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 null terminator */
+ r -= 1;
+
/*
* If the path starts with "\??\", which it will do in most (all?) cases,
* strip those out.