]> Cypherpunks repositories - gostls13.git/commitdiff
os: fix TestDevNullFile on Plan 9
authorDavid du Colombier <0intro@gmail.com>
Mon, 26 Mar 2018 08:41:11 +0000 (10:41 +0200)
committerDavid du Colombier <0intro@gmail.com>
Tue, 27 Mar 2018 05:30:50 +0000 (05:30 +0000)
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>

src/os/stat_plan9.go

index 15999c001c7f3fcf097588920ff86b0126c0a68a..b43339afa43b31594abafcf8f1b2bab36ecf9088 100644 (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
 }