diff --git a/usr.bin/rup/Makefile b/usr.bin/rup/Makefile index 4df0528284f8..cd3ab112fa81 100644 --- a/usr.bin/rup/Makefile +++ b/usr.bin/rup/Makefile @@ -4,6 +4,4 @@ PROG= rup LIBADD= rpcsvc -NO_WCAST_ALIGN= # Size is explicitly handled - .include diff --git a/usr.bin/rup/rup.c b/usr.bin/rup/rup.c index c0cd5f8243ae..aae3639b64d4 100644 --- a/usr.bin/rup/rup.c +++ b/usr.bin/rup/rup.c @@ -120,26 +120,15 @@ rstat_reply(statstime *host_stat, struct sockaddr_in *raddrp) printf("%-*s\t", HOST_WIDTH, host); - if (sizeof(time_t) == sizeof(host_stat->curtime.tv_sec)) { - tmp_time = localtime((time_t *)&host_stat->curtime.tv_sec); - host_time = *tmp_time; + tmp_time_t = host_stat->curtime.tv_sec; + tmp_time = localtime(&tmp_time_t); + host_time = *tmp_time; - host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec; + host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec; - tmp_time = gmtime((time_t *)&host_stat->curtime.tv_sec); - host_uptime = *tmp_time; - } - else { /* non-32-bit time_t */ - tmp_time_t = host_stat->curtime.tv_sec; - tmp_time = localtime(&tmp_time_t); - host_time = *tmp_time; - - host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec; - - tmp_time_t = host_stat->curtime.tv_sec; - tmp_time = gmtime(&tmp_time_t); - host_uptime = *tmp_time; - } + tmp_time_t = host_stat->curtime.tv_sec; + tmp_time = gmtime(&tmp_time_t); + host_uptime = *tmp_time; #define updays (host_stat->curtime.tv_sec / 86400) if (host_uptime.tm_yday != 0) @@ -205,7 +194,7 @@ onehost(char *host) return(-1); } - addr.sin_addr.s_addr = *(int *)hp->h_addr; + memcpy(&addr.sin_addr.s_addr, hp->h_addr, sizeof(int)); rstat_reply(&host_stat, &addr); clnt_destroy(rstat_clnt); return (0);