correct return value for nonblocking buffer write