]> Cypherpunks repositories - gostls13.git/commit
os: fix handling of ErrShortWrite in (*File).Write
authorIan Lance Taylor <iant@golang.org>
Wed, 17 May 2017 00:41:42 +0000 (17:41 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 17 May 2017 01:04:53 +0000 (01:04 +0000)
commit0fd7de4971c89e782434a402dbb69c5fd17457f9
treea6acb3b98868640efe1683b26627cf4098185c71
parent13cdd814ea0e8ef165ab54802f9f102b8b690df7
os: fix handling of ErrShortWrite in (*File).Write

Restore the handling of io.ErrShortWrite in (*File).Write:
if we write less than the requested amount, and there is no error from
the syscall, then return io.ErrShortWrite.

I can't figure out how to write a test for this. It would require a
non-pollable file (not a pipe) on a device that is almost but not
quite entirely full. The original code (https://golang.org/cl/36800043,
committed as part of https://golang.org/cl/36930044) does not have a test.

Fixes #20386.

Change-Id: Ied7b411e621e1eaf49f864f8db90069f276256f5
Reviewed-on: https://go-review.googlesource.com/43558
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/os/file.go