aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/os/file.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/os/file.go')
-rw-r--r--libgo/go/os/file.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/libgo/go/os/file.go b/libgo/go/os/file.go
index 8c0e3ffe1ba..4f8e3f3450c 100644
--- a/libgo/go/os/file.go
+++ b/libgo/go/os/file.go
@@ -52,8 +52,8 @@ var (
Stderr = NewFile(uintptr(syscall.Stderr), "/dev/stderr")
)
-// Flags to Open wrapping those of the underlying system. Not all flags
-// may be implemented on a given system.
+// Flags to OpenFile wrapping those of the underlying system. Not all
+// flags may be implemented on a given system.
const (
O_RDONLY int = syscall.O_RDONLY // open the file read-only.
O_WRONLY int = syscall.O_WRONLY // open the file write-only.
@@ -93,9 +93,6 @@ func (f *File) Read(b []byte) (n int, err error) {
return 0, ErrInvalid
}
n, e := f.read(b)
- if n < 0 {
- n = 0
- }
if n == 0 && len(b) > 0 && e == nil {
return 0, io.EOF
}
@@ -176,6 +173,7 @@ func (f *File) WriteAt(b []byte, off int64) (n int, err error) {
// according to whence: 0 means relative to the origin of the file, 1 means
// relative to the current offset, and 2 means relative to the end.
// It returns the new offset and an error, if any.
+// The behavior of Seek on a file opened with O_APPEND is not specified.
func (f *File) Seek(offset int64, whence int) (ret int64, err error) {
if f == nil {
return 0, ErrInvalid
@@ -258,7 +256,9 @@ func Create(name string) (*File, error) {
// lstat is overridden in tests.
var lstat = Lstat
-// Rename renames (moves) a file. OS-specific restrictions might apply.
+// Rename renames (moves) oldpath to newpath.
+// If newpath already exists, Rename replaces it.
+// OS-specific restrictions may apply when oldpath and newpath are in different directories.
// If there is an error, it will be of type *LinkError.
func Rename(oldpath, newpath string) error {
return rename(oldpath, newpath)