summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2014-07-22 23:29:54 +0000
committerpfg <pfg@FreeBSD.org>2014-07-22 23:29:54 +0000
commit607bced4fa031f2dbd13539133b0971e2034c49e (patch)
tree5d43d4f1bb0414058f1a51fef29882b6a22a3a19 /lib/libc
parentdaa5553600df7b8674a3a716ea3add7e93b11703 (diff)
downloadFreeBSD-src-607bced4fa031f2dbd13539133b0971e2034c49e.zip
FreeBSD-src-607bced4fa031f2dbd13539133b0971e2034c49e.tar.gz
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
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdio/fputws.c2
-rw-r--r--lib/libc/stdio/putw.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdio/fputws.c b/lib/libc/stdio/fputws.c
index fa8d317..4153067 100644
--- a/lib/libc/stdio/fputws.c
+++ b/lib/libc/stdio/fputws.c
@@ -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);
diff --git a/lib/libc/stdio/putw.c b/lib/libc/stdio/putw.c
index 0360caf..ecd5d095 100644
--- a/lib/libc/stdio/putw.c
+++ b/lib/libc/stdio/putw.c
@@ -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);
OpenPOWER on IntegriCloud