diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-03-14 18:00:32 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-03-14 18:00:32 +0000 |
commit | a65d0760b340749cc44566a7c47fb6fe237d0273 (patch) | |
tree | e862f2cfc02d06926dcc7b0fb74be7fff2690ceb /usr.bin | |
parent | 96f18009292add7b1fc3dc11a6defa138f869e93 (diff) |
use ctime_r to avoid a re-entrancy signal race
ok millert
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/last/last.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c index 6df6fc915b9..042cbadbe68 100644 --- a/usr.bin/last/last.c +++ b/usr.bin/last/last.c @@ -1,4 +1,4 @@ -/* $OpenBSD: last.c,v 1.46 2015/02/08 23:40:34 deraadt Exp $ */ +/* $OpenBSD: last.c,v 1.47 2015/03/14 18:00:31 deraadt Exp $ */ /* $NetBSD: last.c,v 1.6 1994/12/24 16:49:02 cgd Exp $ */ /* @@ -616,9 +616,9 @@ terr: errx(1, "out of range or illegal time specification: " void onintr(int signo) { - char str[1024], *ct; + char str[1024], *ct, ctbuf[26]; - ct = ctime(&buf[0].ut_time); /* XXX signal race */ + ct = ctime_r(&buf[0].ut_time, ctbuf); snprintf(str, sizeof str, "\ninterrupted %10.10s %8.8s \n", ct, ct + 11); write(STDOUT_FILENO, str, strlen(str)); |