mirror of
https://github.com/golang/go
synced 2024-11-17 09:44:48 -07:00
os: clarify that mode argument is only used if file is created
Fixes #30400 Change-Id: Icbd1dda29562afa80c8e37657133a6fe48070ac0 Reviewed-on: https://go-review.googlesource.com/c/163744 Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
dc0455225a
commit
4b05dc91b0
@ -265,10 +265,10 @@ func Open(name string) (*File, error) {
|
||||
return OpenFile(name, O_RDONLY, 0)
|
||||
}
|
||||
|
||||
// Create creates the named file with mode 0666 (before umask), truncating
|
||||
// it if it already exists. If successful, methods on the returned
|
||||
// File can be used for I/O; the associated file descriptor has mode
|
||||
// O_RDWR.
|
||||
// Create creates or truncates the named file. If the file already exists,
|
||||
// it is truncated. If the file does not exist, it is created with mode 0666
|
||||
// (before umask). If successful, methods on the returned File can
|
||||
// be used for I/O; the associated file descriptor has mode O_RDWR.
|
||||
// If there is an error, it will be of type *PathError.
|
||||
func Create(name string) (*File, error) {
|
||||
return OpenFile(name, O_RDWR|O_CREATE|O_TRUNC, 0666)
|
||||
@ -276,7 +276,8 @@ func Create(name string) (*File, error) {
|
||||
|
||||
// OpenFile is the generalized open call; most users will use Open
|
||||
// or Create instead. It opens the named file with specified flag
|
||||
// (O_RDONLY etc.) and perm (before umask), if applicable. If successful,
|
||||
// (O_RDONLY etc.). If the file does not exist, and the O_CREATE flag
|
||||
// is passed, it is created with mode perm (before umask). If successful,
|
||||
// methods on the returned File can be used for I/O.
|
||||
// If there is an error, it will be of type *PathError.
|
||||
func OpenFile(name string, flag int, perm FileMode) (*File, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user