1
0
mirror of https://github.com/golang/go synced 2024-11-12 03:40:21 -07:00

os: include 0111 in directory file mode on windows

Fixes #4444.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6858079
This commit is contained in:
Alex Brainman 2012-11-28 17:01:59 +11:00
parent 16a5934540
commit 5b65023563
2 changed files with 13 additions and 1 deletions

View File

@ -1095,3 +1095,15 @@ func TestLargeWriteToConsole(t *testing.T) {
t.Errorf("Write to os.Stderr should return %d; got %d", len(b), n)
}
}
func TestStatDirModeExec(t *testing.T) {
const mode = 0111
const path = "."
dir, err := Stat(path)
if err != nil {
t.Fatalf("Stat %q (looking for mode %#o): %s", path, mode, err)
}
if dir.Mode()&mode != mode {
t.Errorf("Stat %q: mode %#o want %#o", path, dir.Mode(), mode)
}
}

View File

@ -190,7 +190,7 @@ func mkModTime(mtime syscall.Filetime) time.Time {
func mkMode(fa uint32) (m FileMode) {
if fa&syscall.FILE_ATTRIBUTE_DIRECTORY != 0 {
m |= ModeDir
m |= ModeDir | 0111
}
if fa&syscall.FILE_ATTRIBUTE_READONLY != 0 {
m |= 0444