From 838c00236b8cd91879cd7a43b23fd66a0b957aa6 Mon Sep 17 00:00:00 2001 From: David Malone Date: Wed, 19 May 2004 21:34:52 +0000 Subject: [PATCH] Fix a couple of warnings: 1) Missing include for declaration of time conversion functions. 2) Avoid a couple of alignment warnings on 64 bit arches by memcpying the things pointed to by caddrs into variables of the right type. Bump WARNS to 6 while I'm here. --- usr.bin/rusers/Makefile | 1 + usr.bin/rusers/rusers.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/usr.bin/rusers/Makefile b/usr.bin/rusers/Makefile index 6cb39acd29e4..21d0ce24a706 100644 --- a/usr.bin/rusers/Makefile +++ b/usr.bin/rusers/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ PROG = rusers +WARNS?= 6 DPADD= ${LIBRPCSVC} LDADD= -lrpcsvc diff --git a/usr.bin/rusers/rusers.c b/usr.bin/rusers/rusers.c index 7d2fc0acd9d3..87f46608870b 100644 --- a/usr.bin/rusers/rusers.c +++ b/usr.bin/rusers/rusers.c @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #define MAX_INT 0x7fffffff @@ -97,10 +98,12 @@ rusers_reply(caddr_t replyp, struct sockaddr_in *raddrp) int idle; char date[32], idle_time[64], remote[64]; struct hostent *hp; - utmpidlearr *up = (utmpidlearr *)replyp; + utmpidlearr *up, u; char *host; int days, hours, minutes, seconds; + up = &u; + memcpy(up, replyp, sizeof(*up)); if (search_host(raddrp->sin_addr)) return (0); @@ -191,7 +194,7 @@ onehost(char *host) if (clnt_call(rusers_clnt, RUSERSPROC_NAMES, (xdrproc_t)xdr_void, NULL, (xdrproc_t)xdr_utmpidlearr, &up, tv) != RPC_SUCCESS) errx(1, "%s", clnt_sperror(rusers_clnt, "")); - addr.sin_addr.s_addr = *(int *)hp->h_addr; + memcpy(&addr.sin_addr.s_addr, hp->h_addr, sizeof(addr.sin_addr.s_addr)); rusers_reply((caddr_t)&up, &addr); clnt_destroy(rusers_clnt); }