os: do not assume syscall.Write will write everything

Fixes #3323.

R=golang-dev, remyoudompheng, gri
CC=golang-dev
https://golang.org/cl/5837047
1 file changed