diff options
-rw-r--r-- | usr.bin/lock/lock.c | 19 | ||||
-rw-r--r-- | usr.bin/write/write.c | 6 |
2 files changed, 14 insertions, 11 deletions
diff --git a/usr.bin/lock/lock.c b/usr.bin/lock/lock.c index dcd017f9dd5..6ce6c456dc3 100644 --- a/usr.bin/lock/lock.c +++ b/usr.bin/lock/lock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lock.c,v 1.13 2001/05/29 21:38:15 millert Exp $ */ +/* $OpenBSD: lock.c,v 1.14 2001/11/02 16:25:11 deraadt Exp $ */ /* $NetBSD: lock.c,v 1.8 1996/05/07 18:32:31 jtc Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)lock.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: lock.c,v 1.13 2001/05/29 21:38:15 millert Exp $"; +static char rcsid[] = "$OpenBSD: lock.c,v 1.14 2001/11/02 16:25:11 deraadt Exp $"; #endif /* not lint */ /* @@ -223,16 +223,19 @@ void hi(dummy) int dummy; { + char buf[1024], buf2[1024]; time_t now; - (void)fprintf(stderr, "%s: type in the unlock key.", __progname); - if (!no_timeout) { + if (no_timeout) + buf2[0] = '\0'; + else { now = time(NULL); - (void)fprintf(stderr, " timeout in %d:%d minutes", - (nexttime - now) / 60, - (nexttime - now) % 60); + (void)snprintf(buf2, sizeof buf2, " timeout in %d:%d minutes", + (nexttime - now) / 60, (nexttime - now) % 60); } - putc('\n', stderr); + snprintf(buf, sizeof buf, "%s: type in the unlock key.%s\n", + __progname, buf2); + (void) write(STDERR_FILENO, buf, strlen(buf)); } void diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c index 81c0f647cb6..46f83c37ae1 100644 --- a/usr.bin/write/write.c +++ b/usr.bin/write/write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: write.c,v 1.12 2001/06/27 06:53:55 jasoni Exp $ */ +/* $OpenBSD: write.c,v 1.13 2001/11/02 16:25:30 deraadt Exp $ */ /* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)write.c 8.2 (Berkeley) 4/27/95"; #endif -static char *rcsid = "$OpenBSD: write.c,v 1.12 2001/06/27 06:53:55 jasoni Exp $"; +static char *rcsid = "$OpenBSD: write.c,v 1.13 2001/11/02 16:25:30 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -290,7 +290,7 @@ do_write(tty, mytty, myuid) void done(int sig) { - (void)printf("EOF\r\n"); /* XXX signal race */ + (void)write(STDOUT_FILENO, "EOF\r\n", 5); if (sig) _exit(0); else |