Avoid possible cast degradation.

For consistency with r268985 for fputs.c, assign iov_len
first, avoiding the cast to uio_resid (int in stdio)
from degrading the value.

We currently don't support lengths higher than INT_MAX so
this change is little more than cosmetic.

MFC after:	3 days
This commit is contained in:
Pedro F. Giffuni 2014-07-22 23:29:54 +00:00
parent 95d45410b5
commit 86727cc9c6
2 changed files with 2 additions and 2 deletions

View File

@ -67,7 +67,7 @@ fputws_l(const wchar_t * __restrict ws, FILE * __restrict fp, locale_t locale)
&fp->_mbstate);
if (nbytes == (size_t)-1)
goto error;
iov.iov_len = uio.uio_resid = nbytes;
uio.uio_resid = iov.iov_len = nbytes;
if (__sfvwrite(fp, &uio) != 0)
goto error;
} while (wsp != NULL);

View File

@ -50,7 +50,7 @@ putw(int w, FILE *fp)
struct __siov iov;
iov.iov_base = &w;
iov.iov_len = uio.uio_resid = sizeof(w);
uio.uio_resid = iov.iov_len = sizeof(w);
uio.uio_iov = &iov;
uio.uio_iovcnt = 1;
FLOCKFILE(fp);