From 4fae240153a5300b7108bf5c2de2b6581c8ee7fd Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 4 Nov 2018 22:01:18 +0100 Subject: fusefrontend: make Readlink() symlink-safe Now symlink-safe through Readlinkat(). --- internal/syscallcompat/sys_common.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'internal/syscallcompat/sys_common.go') diff --git a/internal/syscallcompat/sys_common.go b/internal/syscallcompat/sys_common.go index c1fd00a..33ed807 100644 --- a/internal/syscallcompat/sys_common.go +++ b/internal/syscallcompat/sys_common.go @@ -10,10 +10,8 @@ import ( // It is not defined on Darwin, so we use the Linux value. const PATH_MAX = 4096 -// Readlinkat exists both in Linux and in MacOS 10.10+. We may add an -// emulated version for users on older MacOS versions if there is -// demand. -// Buffer allocation is handled internally, unlike the bare unix.Readlinkat. +// Readlinkat is a convenience wrapper around unix.Readlinkat() that takes +// care of buffer sizing. Implemented like os.Readlink(). func Readlinkat(dirfd int, path string) (string, error) { // Allocate the buffer exponentially like os.Readlink does. for bufsz := 128; ; bufsz *= 2 { -- cgit v1.2.3