From ba244939e64676bf21827e45a0a1ad469d23e8de Mon Sep 17 00:00:00 2001 From: cognet Date: Sun, 3 Aug 2008 20:36:40 +0000 Subject: ctime() expects a time_t, but qup->dqblk.dqb_btime is an int32_t, so for big endian platforms where time_t is 64bits (ie armeb and sparc64), it will be a problem. Use a temporary time_t to work around this. Submitted by: Matthew Luckie MFC after: 3 days --- usr.bin/quota/quota.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/usr.bin/quota/quota.c b/usr.bin/quota/quota.c index c725ad9..7b0763d 100644 --- a/usr.bin/quota/quota.c +++ b/usr.bin/quota/quota.c @@ -396,6 +396,7 @@ showrawquotas(type, id, qup) u_long id; struct quotause *qup; { + time_t tt; printf("Raw %s quota information for id %lu on %s\n", type == USRQUOTA ? "user" : "group", id, qup->fsname); printf("block hard limit: %ju\n", (uintmax_t)qup->dqblk.dqb_bhardlimit); @@ -405,14 +406,16 @@ showrawquotas(type, id, qup) printf("i-node soft limit: %ju\n", (uintmax_t)qup->dqblk.dqb_isoftlimit); printf("current i-node count: %ju\n", (uintmax_t)qup->dqblk.dqb_curinodes); printf("block grace time: %jd", (intmax_t)qup->dqblk.dqb_btime); - if (qup->dqblk.dqb_btime != 0) - printf(" %s", ctime(&qup->dqblk.dqb_btime)); - else + if (qup->dqblk.dqb_btime != 0) { + tt = qup->dqblk.dqb_btime; + printf(" %s", ctime(&tt)); + } else printf("\n"); printf("i-node grace time: %jd", (intmax_t)qup->dqblk.dqb_itime); - if (qup->dqblk.dqb_itime != 0) - printf(" %s", ctime(&qup->dqblk.dqb_itime)); - else + if (qup->dqblk.dqb_itime != 0) { + tt = qup->dqblk.dqb_itime; + printf(" %s", ctime(&tt)); + } else printf("\n"); } -- cgit v1.1