summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2013-04-03 04:12:23 +0000
committerderaadt <deraadt@openbsd.org>2013-04-03 04:12:23 +0000
commit207ac8186721f393f559d93024c92aac400ebea0 (patch)
treeb6ac8e447d6d2f9e1f7c9ae5a2324ab4852d04d9
parentUpdate a comment about standards requirements (diff)
downloadwireguard-openbsd-207ac8186721f393f559d93024c92aac400ebea0.tar.xz
wireguard-openbsd-207ac8186721f393f559d93024c92aac400ebea0.zip
do not assume time_t and timeval.tv_sec are the same type
-rw-r--r--usr.bin/rup/rup.c6
-rw-r--r--usr.bin/rusers/rusers.c5
2 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/rup/rup.c b/usr.bin/rup/rup.c
index f2ddb26ba67..c7d31f30b14 100644
--- a/usr.bin/rup/rup.c
+++ b/usr.bin/rup/rup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rup.c,v 1.24 2009/10/27 23:59:43 deraadt Exp $ */
+/* $OpenBSD: rup.c,v 1.25 2013/04/03 04:12:23 deraadt Exp $ */
/*-
* Copyright (c) 1993, John Brezak
@@ -180,13 +180,15 @@ print_rup_data(char *host, statstime *host_stat)
unsigned int ups = 0, upm = 0, uph = 0, upd = 0;
struct tm *tmp_time, host_time;
char days_buf[16], hours_buf[16];
+ time_t tim;
if (printtime)
printf("%-*.*s", HOST_WIDTH-8, HOST_WIDTH-8, host);
else
printf("%-*.*s", HOST_WIDTH, HOST_WIDTH, host);
- tmp_time = localtime((time_t *)&host_stat->curtime.tv_sec);
+ tim = host_stat->curtime.tv_sec;
+ tmp_time = localtime(&tim);
host_time = *tmp_time;
host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec;
diff --git a/usr.bin/rusers/rusers.c b/usr.bin/rusers/rusers.c
index f9dc5f5cddb..fb1937281eb 100644
--- a/usr.bin/rusers/rusers.c
+++ b/usr.bin/rusers/rusers.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rusers.c,v 1.30 2009/10/27 23:59:43 deraadt Exp $ */
+/* $OpenBSD: rusers.c,v 1.31 2013/04/03 04:12:49 deraadt Exp $ */
/*
* Copyright (c) 2001, 2003 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -647,8 +647,9 @@ print_entry(struct host_info *entry, int longfmt)
for (i = 0, ut = entry->users; i < entry->count; i++, ut++) {
if (longfmt) {
+ time_t tim = ut->ut_time;
strftime(date, sizeof(date), "%h %d %R",
- localtime((time_t *)&ut->ut_time));
+ localtime(&tim));
date[sizeof(date) - 1] = '\0';
fmt_idle(ut->ut_idle, idle_time, sizeof(idle_time));
len = termwidth -