From a362d5461483190cbaf995e6cb7aaa47c32ebe36 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sat, 9 Apr 2022 21:00:59 -0700 Subject: [PATCH] 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 Reviewed-by: Emmanuel Odeke Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor TryBot-Result: Gopher Robot Reviewed-by: Russ Cox --- src/os/stat_solaris.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/os/stat_solaris.go b/src/os/stat_solaris.go index 316c26c7ca..4e00ecb075 100644 --- a/src/os/stat_solaris.go +++ b/src/os/stat_solaris.go @@ -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 -- 2.50.0