summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2011-04-26 20:14:29 +0000
committerjhb <jhb@FreeBSD.org>2011-04-26 20:14:29 +0000
commitefe1808e9f275c15c3014215e1ad0a85a9aae675 (patch)
tree8890c14a34f091134243252ccd06f416a7ef18bc /usr.bin
parentc809661e09e3375509da16f0f26ab605249d1351 (diff)
downloadFreeBSD-src-efe1808e9f275c15c3014215e1ad0a85a9aae675.zip
FreeBSD-src-efe1808e9f275c15c3014215e1ad0a85a9aae675.tar.gz
Generate the network byte order version of the window size structure in a
temporary variable on the stack and then copy that into the output buffer so that the htons() conversions use aligned accesses. MFC after: 1 month
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rlogin/rlogin.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/rlogin/rlogin.c b/usr.bin/rlogin/rlogin.c
index 328ff5f..4d1f7b0 100644
--- a/usr.bin/rlogin/rlogin.c
+++ b/usr.bin/rlogin/rlogin.c
@@ -484,18 +484,18 @@ sigwinch(int signo __unused)
void
sendwindow(void)
{
- struct winsize *wp;
+ struct winsize ws;
char obuf[4 + sizeof (struct winsize)];
- wp = (struct winsize *)(obuf+4);
obuf[0] = 0377;
obuf[1] = 0377;
obuf[2] = 's';
obuf[3] = 's';
- wp->ws_row = htons(winsize.ws_row);
- wp->ws_col = htons(winsize.ws_col);
- wp->ws_xpixel = htons(winsize.ws_xpixel);
- wp->ws_ypixel = htons(winsize.ws_ypixel);
+ ws.ws_row = htons(winsize.ws_row);
+ ws.ws_col = htons(winsize.ws_col);
+ ws.ws_xpixel = htons(winsize.ws_xpixel);
+ ws.ws_ypixel = htons(winsize.ws_ypixel);
+ bcopy(&ws, obuf + 4, sizeof(ws));
(void)write(rem, obuf, sizeof(obuf));
}
OpenPOWER on IntegriCloud