summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1997-04-04 08:59:38 +0000
committerderaadt <deraadt@openbsd.org>1997-04-04 08:59:38 +0000
commit8e4809e269ad6e52848b47922f3a3c57ab5155f3 (patch)
tree02a0bace84a4a271f79b9e94ed477f2fde760981
parentmention mr.tarkovskey (diff)
downloadwireguard-openbsd-8e4809e269ad6e52848b47922f3a3c57ab5155f3.tar.xz
wireguard-openbsd-8e4809e269ad6e52848b47922f3a3c57ab5155f3.zip
wtmp repairs; netbsd
-rw-r--r--bin/date/date.c7
-rw-r--r--usr.sbin/rdate/Makefile4
-rw-r--r--usr.sbin/rdate/rdate.89
-rw-r--r--usr.sbin/rdate/rdate.c43
4 files changed, 36 insertions, 27 deletions
diff --git a/bin/date/date.c b/bin/date/date.c
index 58bd4ef0f95..21657cf53aa 100644
--- a/bin/date/date.c
+++ b/bin/date/date.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: date.c,v 1.2 1996/06/23 14:19:42 deraadt Exp $ */
+/* $OpenBSD: date.c,v 1.3 1997/04/04 08:59:38 deraadt Exp $ */
/* $NetBSD: date.c,v 1.11 1995/09/07 06:21:05 jtc Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)date.c 8.2 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$OpenBSD: date.c,v 1.2 1996/06/23 14:19:42 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: date.c,v 1.3 1997/04/04 08:59:38 deraadt Exp $";
#endif
#endif /* not lint */
@@ -60,6 +60,7 @@ static char rcsid[] = "$OpenBSD: date.c,v 1.2 1996/06/23 14:19:42 deraadt Exp $"
#include <locale.h>
#include <syslog.h>
#include <unistd.h>
+#include <util.h>
#include "extern.h"
@@ -70,8 +71,6 @@ static void setthetime __P((char *));
static void badformat __P((void));
static void usage __P((void));
-int logwtmp __P((char *, char *, char *));
-
int
main(argc, argv)
int argc;
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;
}