mirror of
https://github.com/rclone/rclone.git
synced 2025-08-09 21:57:59 +02:00
vfs: convert vfs options to new style
This also - move in use options (Opt) from vfsflags to vfscommon - change os.FileMode to vfscommon.FileMode in parameters - rework vfscommon.FileMode and add tests
This commit is contained in:
24
vfs/vfscommon/vfsflags_unix.go
Normal file
24
vfs/vfscommon/vfsflags_unix.go
Normal file
@ -0,0 +1,24 @@
|
||||
//go:build linux || darwin || freebsd
|
||||
|
||||
package vfscommon
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// get the current umask
|
||||
func getUmask() int {
|
||||
umask := unix.Umask(0) // read the umask
|
||||
unix.Umask(umask) // set it back to what it was
|
||||
return umask
|
||||
}
|
||||
|
||||
// get the current uid
|
||||
func getUID() uint32 {
|
||||
return uint32(unix.Geteuid())
|
||||
}
|
||||
|
||||
// get the current gid
|
||||
func getGID() uint32 {
|
||||
return uint32(unix.Getegid())
|
||||
}
|
Reference in New Issue
Block a user