summaryrefslogtreecommitdiff
path: root/bin/date
diff options
context:
space:
mode:
Diffstat (limited to 'bin/date')
-rw-r--r--bin/date/date.16
-rw-r--r--bin/date/date.c14
2 files changed, 17 insertions, 3 deletions
diff --git a/bin/date/date.1 b/bin/date/date.1
index 85166a82451..56e32d15850 100644
--- a/bin/date/date.1
+++ b/bin/date/date.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: date.1,v 1.49 2009/02/08 17:15:09 jmc Exp $
+.\" $OpenBSD: date.1,v 1.50 2010/03/31 17:51:21 deraadt Exp $
.\" $NetBSD: date.1,v 1.12 1996/03/12 04:32:37 phil Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
@@ -33,7 +33,7 @@
.\"
.\" @(#)date.1 8.3 (Berkeley) 4/28/95
.\"
-.Dd $Mdocdate: February 8 2009 $
+.Dd $Mdocdate: March 31 2010 $
.Dt DATE 1
.Os
.Sh NAME
@@ -64,6 +64,8 @@ Otherwise, depending on the options specified,
will set the date and time or print it in a user-defined way.
.Pp
Only the superuser may set the date.
+Changing the system date has some risks as described in
+.Xr settimeofday 2 .
.Pp
The options are as follows:
.Bl -tag -width Ds
diff --git a/bin/date/date.c b/bin/date/date.c
index e58029c6868..1f6ce05872b 100644
--- a/bin/date/date.c
+++ b/bin/date/date.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: date.c,v 1.32 2009/10/27 23:59:21 deraadt Exp $ */
+/* $OpenBSD: date.c,v 1.33 2010/03/31 17:51:21 deraadt Exp $ */
/* $NetBSD: date.c,v 1.11 1995/09/07 06:21:05 jtc Exp $ */
/*
@@ -226,12 +226,16 @@ setthetime(char *p)
if (adjtime(&tv, NULL) == -1)
errx(1, "adjtime");
} else {
+#ifndef SMALL
logwtmp("|", "date", "");
+#endif
tv.tv_sec = tval;
tv.tv_usec = 0;
if (settimeofday(&tv, NULL))
err(1, "settimeofday");
+#ifndef SMALL
logwtmp("{", "date", "");
+#endif
}
}
@@ -240,6 +244,14 @@ setthetime(char *p)
syslog(LOG_AUTH | LOG_NOTICE, "date set by %s", p);
}
+#ifdef SMALL
+int
+netsettime(tval)
+{
+ return (2);
+}
+#endif
+
static void
badformat(void)
{