1
0
mirror of https://github.com/golang/go synced 2024-09-30 20:18:33 -06:00

os: fix TestDevNullFile on Plan 9

CL 102457 added TestDevNullFile. However, this
test is failing on Plan 9, because it checks
that /dev/null is a character device while there
are no special files on Plan 9.

We fix this issue by changing Stat to consider
all files served by the console device (#c)
as character devices.

Fixes #24534.

Change-Id: I1c60cdf25770358b908790b3fb71910fa914dec0
Reviewed-on: https://go-review.googlesource.com/102424
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
David du Colombier 2018-03-26 10:41:11 +02:00
parent 131901e80d
commit 49325dc1d2

View File

@ -35,6 +35,10 @@ func fileInfoFromStat(d *syscall.Dir) FileInfo {
if d.Type != 'M' {
fs.mode |= ModeDevice
}
// Consider all files served by #c as character device files.
if d.Type == 'c' {
fs.mode |= ModeCharDevice
}
return fs
}