diff options
| author | Constantin Konstantinidis <constantinkonstantinidis@gmail.com> | 2019-07-15 06:32:40 +0200 |
|---|---|---|
| committer | Alex Brainman <alex.brainman@gmail.com> | 2019-08-29 09:53:56 +0000 |
| commit | 5cf5a6fc5eca5e05ab7cd189a19196e73c5408c4 (patch) | |
| tree | 5dd002456536f92bbe4dcde33b6bd94226bff809 /src/os/os_windows_test.go | |
| parent | cb325fed43009d5197caa5b1afa859cbc0e39355 (diff) | |
| download | go-5cf5a6fc5eca5e05ab7cd189a19196e73c5408c4.tar.xz | |
os: return an error when the argument of Mkdir on Windows is os.DevNull
Test added.
Fixes #24556
Change-Id: I4d1cd4513142edeea1a983fbfde46c2fccecab2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/186139
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Diffstat (limited to 'src/os/os_windows_test.go')
| -rw-r--r-- | src/os/os_windows_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/os/os_windows_test.go b/src/os/os_windows_test.go index 326670cc9d..2693904e56 100644 --- a/src/os/os_windows_test.go +++ b/src/os/os_windows_test.go @@ -1168,3 +1168,19 @@ func TestWindowsReadlink(t *testing.T) { mklink(t, "relfilelink", "file") testReadlink(t, "relfilelink", "file") } + +// os.Mkdir(os.DevNull) fails. +func TestMkdirDevNull(t *testing.T) { + err := os.Mkdir(os.DevNull, 777) + oserr, ok := err.(*os.PathError) + if !ok { + t.Fatalf("error (%T) is not *os.PathError", err) + } + errno, ok := oserr.Err.(syscall.Errno) + if !ok { + t.Fatalf("error (%T) is not syscall.Errno", oserr) + } + if errno != syscall.ENOTDIR { + t.Fatalf("error %d is not syscall.ENOTDIR", errno) + } +}
\ No newline at end of file |
