Fix bogus return values from libc_r's write() routine in situations where a partial-write is followed by an error.
Fix bogus return values from libc_r's write() routine in situations where
a partial-write is followed by an error.

PR:		43335
MFC after:	1 week

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase