os: do not assume syscall i/o funcs return n=0 on error

Fixes issue 9007.

LGTM=iant, r
R=r, iant
CC=golang-codereviews
https://codereview.appspot.com/160670043
doc/go1.4.html: new ports

LGTM=rsc, aram, minux
R=golang-codereviews, aram, minux, rsc
CC=golang-codereviews
https://codereview.appspot.com/162370045