Files
wazero/internal/platform/chown.go
Crypt Keeper 1047ddee78 Adds platform.File.Chown (#1422)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-05-01 18:32:13 +08:00

29 lines
869 B
Go

package platform
import (
"os"
"syscall"
)
// Chown is like os.Chown, except it returns a syscall.Errno, not a
// fs.PathError. For example, this returns syscall.ENOENT if the path doesn't
// exist. A syscall.Errno of zero is success.
//
// Note: This always returns syscall.ENOSYS on windows.
// See https://linux.die.net/man/3/chown
func Chown(path string, uid, gid int) syscall.Errno {
err := os.Chown(path, uid, gid)
return UnwrapOSError(err)
}
// Lchown is like os.Lchown, except it returns a syscall.Errno, not a
// fs.PathError. For example, this returns syscall.ENOENT if the path doesn't
// exist. A syscall.Errno of zero is success.
//
// Note: This always returns syscall.ENOSYS on windows.
// See https://linux.die.net/man/3/lchown
func Lchown(path string, uid, gid int) syscall.Errno {
err := os.Lchown(path, uid, gid)
return UnwrapOSError(err)
}