37 lines
1.4 KiB
Diff
37 lines
1.4 KiB
Diff
From 73e5fbf143566b9a6cfa06a763335897ad342ae9 Mon Sep 17 00:00:00 2001
|
||
From: Davide Madrisan <davide.madrisan@gmail.com>
|
||
Date: Thu, 20 Dec 2018 22:36:55 +0100
|
||
Subject: [PATCH] wtmpxdump.c: fix a gcc warning
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
wtmpxdump.c: In function ‘dumprecord’:
|
||
wtmpxdump.c:65:17: warning: passing argument 1 of ‘ctime’ from incompatible pointer type [-Wincompatible-pointer-types]
|
||
ct = ctime (&p->ut.ut_tv.tv_sec);
|
||
^~~~~~~~~~~~~~~~~~~
|
||
In file included from wtmpxdump.c:48:
|
||
/usr/include/time.h:142:14: note: expected ‘const time_t *’ {aka ‘const long int *’} but argument is of type ‘__int32_t *’ {aka ‘int *’}
|
||
extern char *ctime (const time_t *__timer) __THROW;
|
||
^~~~~
|
||
|
||
Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
|
||
---
|
||
src/wtmpxdump.c | 3 ++-
|
||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||
|
||
diff --git a/src/wtmpxdump.c b/src/wtmpxdump.c
|
||
index 87829f2..e0c4a5f 100644
|
||
--- a/src/wtmpxdump.c
|
||
+++ b/src/wtmpxdump.c
|
||
@@ -62,7 +62,8 @@ dumprecord (struct utmpxlist *p, int what)
|
||
printf ("%-8.8s %-12.12s %-16.16s ",
|
||
p->ut.ut_user, p->ut.ut_line, p->ut.ut_host);
|
||
|
||
- ct = ctime (&p->ut.ut_tv.tv_sec);
|
||
+ time_t time = p->ut.ut_tv.tv_sec;
|
||
+ ct = ctime (&time);
|
||
printf ("%10.10s %4.4s %5.5s ", ct, ct + 20, ct + 11);
|
||
|
||
mins = (p->delta / 60) % 60;
|