summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2004-05-19 21:34:52 +0000
committerdwmalone <dwmalone@FreeBSD.org>2004-05-19 21:34:52 +0000
commit148418b5da3aaa5d119b1f48c74bc70c7ce05fa6 (patch)
treeda010377cf1cbdea2ed4a981694c5370d693b97b /usr.bin
parent6ad6fb7431aff8fe6eedec26802ecd41dcb8b91f (diff)
downloadFreeBSD-src-148418b5da3aaa5d119b1f48c74bc70c7ce05fa6.zip
FreeBSD-src-148418b5da3aaa5d119b1f48c74bc70c7ce05fa6.tar.gz
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.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rusers/Makefile1
-rw-r--r--usr.bin/rusers/rusers.c7
2 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/rusers/Makefile b/usr.bin/rusers/Makefile
index 6cb39ac..21d0ce2 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 7d2fc0a..87f4660 100644
--- a/usr.bin/rusers/rusers.c
+++ b/usr.bin/rusers/rusers.c
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <timeconv.h>
#include <unistd.h>
#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);
}
OpenPOWER on IntegriCloud