Commit 9cae3aaf authored by Alex Brainman's avatar Alex Brainman Committed by Brad Fitzpatrick

os: do not forget to set ModeDevice when using ModeCharDevice

Fixes #23123

Change-Id: Ia4ac947cc49ef3d150ef60a095b86552dcef397d
Reviewed-on: https://go-review.googlesource.com/84435Reviewed-by: default avatarGiovanni Bajo <rasky@develer.com>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Giovanni Bajo <rasky@develer.com>
parent 144bf04a
......@@ -1881,7 +1881,7 @@ func TestStatStdin(t *testing.T) {
t.Fatal(err)
}
switch mode := fi.Mode(); {
case mode&ModeCharDevice != 0:
case mode&ModeCharDevice != 0 && mode&ModeDevice != 0:
case mode&ModeNamedPipe != 0:
default:
t.Fatalf("unexpected Stdin mode (%v), want ModeCharDevice or ModeNamedPipe", mode)
......
......@@ -48,7 +48,7 @@ func (fs *fileStat) Mode() (m FileMode) {
case syscall.FILE_TYPE_PIPE:
m |= ModeNamedPipe
case syscall.FILE_TYPE_CHAR:
m |= ModeCharDevice
m |= ModeDevice | ModeCharDevice
}
return m
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment