Skip to content

Commit 95c9a65

Browse files
mostynbianlancetaylor
authored andcommitted
doc: clarify interaction of ioutil.WriteFile with umask
Note that ioutil.WriteFile's perm argument is the value before the umask is applied. Fixes #35835 Change-Id: I61cd9c88bced3be52b616d86e060cd3fd912ab1f Change-Id: I61cd9c88bced3be52b616d86e060cd3fd912ab1f GitHub-Last-Rev: 0069abb GitHub-Pull-Request: #35836 Reviewed-on: https://go-review.googlesource.com/c/go/+/208838 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 0f25102 commit 95c9a65

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/io/ioutil/ioutil.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ func ReadFile(filename string) ([]byte, error) {
7474
}
7575

7676
// WriteFile writes data to a file named by filename.
77-
// If the file does not exist, WriteFile creates it with permissions perm;
78-
// otherwise WriteFile truncates it before writing.
77+
// If the file does not exist, WriteFile creates it with permissions perm
78+
// (before umask); otherwise WriteFile truncates it before writing.
7979
func WriteFile(filename string, data []byte, perm os.FileMode) error {
8080
f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)
8181
if err != nil {

0 commit comments

Comments
 (0)