sftp/request_unix.go

26 lines
432 B
Go
Raw Normal View History

// +build !windows,!plan9
package sftp
import (
"fmt"
"syscall"
)
2021-04-26 02:09:01 +08:00
func testFileInfoSysOS(sys interface{}) error {
switch sys := sys.(type) {
case *syscall.Stat_t:
if sys.Uid != 65534 {
return fmt.Errorf("UID failed to match: %d", sys.Uid)
}
if sys.Gid != 65534 {
return fmt.Errorf("GID failed to match: %d", sys.Gid)
}
default:
return fmt.Errorf("unexpected FileInfo.Sys() type: %T", sys)
}
return nil
}