diff options
author | Thomas Munro <tmunro@postgresql.org> | 2022-10-25 15:13:52 +1300 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2022-10-25 15:13:52 +1300 |
commit | 4650036f5ab81c93e3b6ed549ef672a325b79705 (patch) | |
tree | 011d5502765fd586853caee1ac3236e186ec7e29 /src | |
parent | 359d601095ce2361bad50f9f8b0bcfe4da1eb886 (diff) | |
download | postgresql-4650036f5ab81c93e3b6ed549ef672a325b79705.tar.gz postgresql-4650036f5ab81c93e3b6ed549ef672a325b79705.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/port/dirmod.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/port/dirmod.c b/src/port/dirmod.c index 51c9bded8fb..398787360a2 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. |