os: fix handling of ErrShortWrite in (*File).Write
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 <87e9c6d529889242b7e184afb632328636553ab4@golang.org>
Reviewed-by: Brad Fitzpatrick <ae9783c0b0efc69cd85ab025ddd17aa44cdc4aa5@golang.org>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>

nawawi/go,josharian/go,polyverse-security/go,cloudflare/go,nawawi/go,derekmarcotte/go,polyverse-security/go,ImJasonH/go,CAFxX/go,vsekhar/elastic-go,CAFxX/go,codestation/go,josharian/go,josharian/go,vsekhar/elastic-go,codestation/go,akutz/go,cloudflare/go,Cofyc/go,derekmarcotte/go,derekmarcotte/go,nawawi/go,nawawi/go,akutz/go,josharian/go,cloudflare/go,CAFxX/go,codestation/go,derekmarcotte/go,ImJasonH/go,Cofyc/go,vsekhar/elastic-go,cloudflare/go,polyverse-security/go,nawawi/go,derekmarcotte/go,akutz/go,cloudflare/go,polyverse-security/go,nawawi/go,josharian/go,cloudflare/go,CAFxX/go,akutz/go,Cofyc/go,CAFxX/go,codestation/go,CAFxX/go,polyverse-security/go,codestation/go,ImJasonH/go,polyverse-security/go,golang/go,ImJasonH/go,ImJasonH/go,vsekhar/elastic-go,golang/go,codestation/go,CAFxX/go,derekmarcotte/go,akutz/go,derekmarcotte/go,Cofyc/go,ImJasonH/go,polyverse-security/go,cloudflare/go,josharian/go,polyverse-security/go,codestation/go,Cofyc/go,vsekhar/elastic-go,ImJasonH/go,vsekhar/elastic-go,christopher-henderson/Go,cloudflare/go,vsekhar/elastic-go,ImJasonH/go,akutz/go,Cofyc/go,josharian/go,nawawi/go,akutz/go,golang/go,codestation/go,golang/go,nawawi/go,josharian/go,golang/go,golang/go,Cofyc/go,vsekhar/elastic-go,derekmarcotte/go,Cofyc/go,golang/go,CAFxX/go,akutz/go,golang/go