summaryrefslogtreecommitdiff
path: root/bin/date
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2018-04-25 19:37:10 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2018-04-25 19:37:10 +0000
commit2d03785b8b1f4fdc643a0b1c7597307e9dd9495f (patch)
treeb15435cca4f459f23e2bda19eff68430be05bf84 /bin/date
parent745c3110a3ce3f757d8af6db04cadc078f8a5380 (diff)
The time-setting codepath can use pledge "settime" which was added for
ntpd, but apparently date was never revisited. "wpath" is for wtmp logging. "rpath" for the case where -z argument isn't in the standard timezone dir. discussed with tb and guenther
Diffstat (limited to 'bin/date')
-rw-r--r--bin/date/date.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/date/date.c b/bin/date/date.c
index 3a3ff3851a3..0f5dad5b3fa 100644
--- a/bin/date/date.c
+++ b/bin/date/date.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: date.c,v 1.52 2018/02/13 17:28:11 cheloha Exp $ */
+/* $OpenBSD: date.c,v 1.53 2018/04/25 19:37:09 deraadt Exp $ */
/* $NetBSD: date.c,v 1.11 1995/09/07 06:21:05 jtc Exp $ */
/*
@@ -127,7 +127,7 @@ main(int argc, char *argv[])
argc--;
}
- if (pledge("stdio rpath wpath", NULL) == -1)
+ if (pledge("stdio rpath", NULL) == -1)
err(1, "pledge");
if (*argv && **argv == '+') {
@@ -159,6 +159,9 @@ setthetime(char *p)
time_t now;
int yearset = 0;
+ if (pledge("stdio settime rpath wpath", NULL) == -1)
+ err(1, "pledge");
+
for (t = p, dot = NULL; *t; ++t) {
if (isdigit((unsigned char)*t))
continue;