diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-04-04 08:59:42 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-04-04 08:59:42 +0000 |
commit | dda3fad403f4c54dc9f315d4f9738ec3d957621e (patch) | |
tree | 785d6fc6f5d53e96397a0dd775fa3a4f34974251 /usr.sbin | |
parent | 85e5f4724c384ee1ea66726a34928892b176a811 (diff) |
wtmp repairs; netbsd
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/rdate/Makefile | 4 | ||||
-rw-r--r-- | usr.sbin/rdate/rdate.8 | 9 | ||||
-rw-r--r-- | usr.sbin/rdate/rdate.c | 43 |
3 files changed, 33 insertions, 23 deletions
diff --git a/usr.sbin/rdate/Makefile b/usr.sbin/rdate/Makefile index 3988a056acf..c57b5000539 100644 --- a/usr.sbin/rdate/Makefile +++ b/usr.sbin/rdate/Makefile @@ -1,8 +1,10 @@ -# $OpenBSD: Makefile,v 1.2 1996/03/25 15:56:08 niklas Exp $ +# $OpenBSD: Makefile,v 1.3 1997/04/04 08:59:39 deraadt Exp $ # $NetBSD: Makefile,v 1.3 1996/02/22 06:59:15 thorpej Exp $ PROG= rdate SRCS= rdate.c +DPADD+= ${LIBUTIL} +LDADD+= -lutil MAN= rdate.8 diff --git a/usr.sbin/rdate/rdate.8 b/usr.sbin/rdate/rdate.8 index 4d140d9dbf0..bd519edd516 100644 --- a/usr.sbin/rdate/rdate.8 +++ b/usr.sbin/rdate/rdate.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: rdate.8,v 1.4 1996/04/21 23:41:41 deraadt Exp $ +.\" $OpenBSD: rdate.8,v 1.5 1997/04/04 08:59:40 deraadt Exp $ .\" $NetBSD: rdate.8,v 1.4 1996/04/08 20:55:17 jtc Exp $ .\" .\" Copyright (c) 1994 Christos Zoulas @@ -58,6 +58,11 @@ Use the .Xr adjtime 2 call to gradually skew the local time to the remote time rather than just hopping. +.Sh FILES +.Bl -tag -width /var/log/wtmp -compact +.It Pa /var/log/wtmp +A record of date resets and time changes. .Sh SEE ALSO .Xr inetd 1 , -.Xr adjtime 2 +.Xr adjtime 2 , +.Xr gettimeofday 2 diff --git a/usr.sbin/rdate/rdate.c b/usr.sbin/rdate/rdate.c index 1dcd8b42390..ce7ebcf9753 100644 --- a/usr.sbin/rdate/rdate.c +++ b/usr.sbin/rdate/rdate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rdate.c,v 1.8 1997/02/06 15:00:27 kstailey Exp $ */ +/* $OpenBSD: rdate.c,v 1.9 1997/04/04 08:59:41 deraadt Exp $ */ /* $NetBSD: rdate.c,v 1.4 1996/03/16 12:37:45 pk Exp $ */ /* @@ -42,7 +42,7 @@ #if 0 from: static char rcsid[] = "$NetBSD: rdate.c,v 1.3 1996/02/22 06:59:18 thorpej Exp $"; #else -static char rcsid[] = "$OpenBSD: rdate.c,v 1.8 1997/02/06 15:00:27 kstailey Exp $"; +static char rcsid[] = "$OpenBSD: rdate.c,v 1.9 1997/04/04 08:59:41 deraadt Exp $"; #endif #endif /* lint */ @@ -55,6 +55,7 @@ static char rcsid[] = "$OpenBSD: rdate.c,v 1.8 1997/02/06 15:00:27 kstailey Exp #include <sys/socket.h> #include <netdb.h> #include <netinet/in.h> +#include <util.h> #include <time.h> /* seconds from midnight Jan 1900 - 1970 */ @@ -150,21 +151,23 @@ main(argc, argv) tim = ntohl(tim) - DIFFERENCE; if (!pr) { - struct timeval tv; - if (!slidetime) { - tv.tv_sec = tim; - tv.tv_usec = 0; - if (settimeofday(&tv, NULL) == -1) - err(1, "Could not set time of day"); - } else { - struct timeval tv_current; - if (gettimeofday(&tv_current, NULL) == -1) - err(1, "Could not get local time of day"); - adjustment = tv.tv_sec = tim - tv_current.tv_sec; - tv.tv_usec = 0; - if (adjtime(&tv, NULL) == -1) - err(1, "Could not adjust time of day"); - } + struct timeval tv; + if (!slidetime) { + logwtmp("|", "date", ""); + tv.tv_sec = tim; + tv.tv_usec = 0; + if (settimeofday(&tv, NULL) == -1) + err(1, "Could not set time of day"); + logwtmp("{", "date", ""); + } else { + struct timeval tv_current; + if (gettimeofday(&tv_current, NULL) == -1) + err(1, "Could not get local time of day"); + adjustment = tv.tv_sec = tim - tv_current.tv_sec; + tv.tv_usec = 0; + if (adjtime(&tv, NULL) == -1) + err(1, "Could not adjust time of day"); + } } if (!silent) { @@ -176,9 +179,9 @@ main(argc, argv) (void) fputs(buf, stdout); if (slidetime) - (void) fprintf(stdout, - "%s: adjust local clock by %d seconds\n", - __progname, adjustment); + (void) fprintf(stdout, + "%s: adjust local clock by %d seconds\n", + __progname, adjustment); } return 0; } |