mirror of
https://github.com/golang/go
synced 2024-11-12 02:10:21 -07:00
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: 0069abb7c5
GitHub-Pull-Request: golang/go#35836
Reviewed-on: https://go-review.googlesource.com/c/go/+/208838
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
0f25102858
commit
95c9a656ae
@ -74,8 +74,8 @@ func ReadFile(filename string) ([]byte, error) {
|
||||
}
|
||||
|
||||
// WriteFile writes data to a file named by filename.
|
||||
// If the file does not exist, WriteFile creates it with permissions perm;
|
||||
// otherwise WriteFile truncates it before writing.
|
||||
// If the file does not exist, WriteFile creates it with permissions perm
|
||||
// (before umask); otherwise WriteFile truncates it before writing.
|
||||
func WriteFile(filename string, data []byte, perm os.FileMode) error {
|
||||
f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user