1
0
mirror of https://github.com/golang/go synced 2024-11-17 02:54:45 -07:00

os: mark Solaris nam/door/port files as irregular

No test because I'm too lazy to figure out how to create such files.

Fixes #52259

Change-Id: I7a07f49993cf046888729e9206ed53dddcf9cb13
Reviewed-on: https://go-review.googlesource.com/c/go/+/399435
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Ian Lance Taylor 2022-04-09 21:00:59 -07:00 committed by Gopher Robot
parent 370cadd0e4
commit a362d54614

View File

@ -9,6 +9,14 @@ import (
"time"
)
// These constants aren't in the syscall package, which is frozen.
// Values taken from golang.org/x/sys/unix.
const (
_S_IFNAM = 0x5000
_S_IFDOOR = 0xd000
_S_IFPORT = 0xe000
)
func fillFileStatFromSys(fs *fileStat, name string) {
fs.name = basename(name)
fs.size = fs.sys.Size
@ -29,6 +37,8 @@ func fillFileStatFromSys(fs *fileStat, name string) {
// nothing to do
case syscall.S_IFSOCK:
fs.mode |= ModeSocket
case _S_IFNAM, _S_IFDOOR, _S_IFPORT:
fs.mode |= ModeIrregular
}
if fs.sys.Mode&syscall.S_ISGID != 0 {
fs.mode |= ModeSetgid