Return the amount of data written when an error occurs rather than
the error.

The change lets the mrfs_fsrdwr test pass.