diff options
Diffstat (limited to 'src/backend/storage/file/fd.c')
-rw-r--r-- | src/backend/storage/file/fd.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 68d43c66b6f..78aade98d1d 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -2517,18 +2517,17 @@ walkdir(char *path, void (*action) (char *fname, bool isdir)) int len; struct stat lst; - len = readlink(subpath, linkpath, sizeof(linkpath) - 1); + len = readlink(subpath, linkpath, sizeof(linkpath)); if (len < 0) ereport(ERROR, (errcode_for_file_access(), errmsg("could not read symbolic link \"%s\": %m", subpath))); - - if (len >= sizeof(linkpath) - 1) + if (len >= sizeof(linkpath)) ereport(ERROR, - (errmsg("symbolic link \"%s\" target is too long", + (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), + errmsg("symbolic link \"%s\" target is too long", subpath))); - linkpath[len] = '\0'; if (lstat(linkpath, &lst) == 0) |