From 416c6c246c1a340d598a0b951a7f1405cc61626a Mon Sep 17 00:00:00 2001 From: millert Date: Mon, 26 Oct 2015 15:50:06 +0000 Subject: [PATCH] Remove TMPDIR support, it is not really useful in crontab. OK deraadt@ --- usr.sbin/cron/crontab.1 | 12 +++--------- usr.sbin/cron/crontab.c | 12 +++--------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/usr.sbin/cron/crontab.1 b/usr.sbin/cron/crontab.1 index 3b0b5cda81f..7aeca2d75c5 100644 --- a/usr.sbin/cron/crontab.1 +++ b/usr.sbin/cron/crontab.1 @@ -17,9 +17,9 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT .\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.\" $OpenBSD: crontab.1,v 1.32 2014/02/12 10:07:33 schwarze Exp $ +.\" $OpenBSD: crontab.1,v 1.33 2015/10/26 15:50:06 millert Exp $ .\" -.Dd $Mdocdate: February 12 2014 $ +.Dd $Mdocdate: October 26 2015 $ .Dt CRONTAB 1 .Os .Sh NAME @@ -117,7 +117,7 @@ you should always use the option for safety's sake. .El .Sh ENVIRONMENT -.Bl -tag -width "TMPDIR" +.Bl -tag -width "EDITOR" .It Ev EDITOR , VISUAL Specifies an editor to use. If both @@ -133,12 +133,6 @@ nor .Ev VISUAL are set, the default is .Xr vi 1 . -.It Ev TMPDIR -Directory in which to place temporary files used by -.Nm Fl e . -If unset, -.Pa /tmp -is used. .El .Sh FILES .Bl -tag -width "/var/cron/cron.allow" -compact diff --git a/usr.sbin/cron/crontab.c b/usr.sbin/cron/crontab.c index 05d90d07e87..17830229cdb 100644 --- a/usr.sbin/cron/crontab.c +++ b/usr.sbin/cron/crontab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crontab.c,v 1.73 2015/10/26 14:27:41 millert Exp $ */ +/* $OpenBSD: crontab.c,v 1.74 2015/10/26 15:50:06 millert Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") @@ -264,7 +264,6 @@ static void edit_cmd(void) { char n[MAX_FNAME], q[MAX_TEMPSTR]; - const char *tmpdir; FILE *f; int t; struct stat statbuf, xstatbuf; @@ -300,13 +299,8 @@ edit_cmd(void) (void)signal(SIGINT, SIG_IGN); (void)signal(SIGQUIT, SIG_IGN); - tmpdir = getenv("TMPDIR"); - if (tmpdir == NULL || tmpdir[0] == '\0') - tmpdir = _PATH_TMP; - for (t = strlen(tmpdir); t != 0 && tmpdir[t - 1] == '/'; t--) - continue; - if (snprintf(Filename, sizeof Filename, "%.*s/crontab.XXXXXXXXXX", - t, tmpdir) >= sizeof(Filename)) { + if (snprintf(Filename, sizeof Filename, "%scrontab.XXXXXXXXXX", + _PATH_TMP) >= sizeof(Filename)) { fprintf(stderr, "path too long\n"); goto fatal; } -- 2.20.1