From 9737f5f78b0cc6f178868efe7c2d1d10551e939a Mon Sep 17 00:00:00 2001 From: tedu Date: Thu, 28 Jul 2016 21:37:45 +0000 Subject: [PATCH] these programs probably do not need to use TMPDIR. ok florian --- usr.bin/ftp/ftp.1 | 6 ++---- usr.bin/ftp/util.c | 5 ++--- usr.bin/mail/mail.1 | 6 ++---- usr.bin/mail/temp.c | 5 ++--- usr.bin/mg/fileio.c | 14 +++----------- usr.bin/mg/mg.1 | 12 ++++++------ 6 files changed, 17 insertions(+), 31 deletions(-) diff --git a/usr.bin/ftp/ftp.1 b/usr.bin/ftp/ftp.1 index 17af9782bc3..ffa55993673 100644 --- a/usr.bin/ftp/ftp.1 +++ b/usr.bin/ftp/ftp.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ftp.1,v 1.101 2015/11/05 16:25:57 schwarze Exp $ +.\" $OpenBSD: ftp.1,v 1.102 2016/07/28 21:37:45 tedu Exp $ .\" $NetBSD: ftp.1,v 1.22 1997/08/18 10:20:22 lukem Exp $ .\" .\" Copyright (c) 1985, 1989, 1990, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)ftp.1 8.3 (Berkeley) 10/9/94 .\" -.Dd $Mdocdate: November 5 2015 $ +.Dd $Mdocdate: July 28 2016 $ .Dt FTP 1 .Os .Sh NAME @@ -1727,8 +1727,6 @@ Used by to display files. .It Ev SHELL For default shell. -.It Ev TMPDIR -Directory in which temporary files are stored. .It Ev ftp_proxy URL of FTP proxy to use when making FTP URL requests (if not defined, use the standard FTP protocol). diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c index d1e52fa0812..184a0a8b4f4 100644 --- a/usr.bin/ftp/util.c +++ b/usr.bin/ftp/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.77 2016/03/16 15:41:11 krw Exp $ */ +/* $OpenBSD: util.c,v 1.78 2016/07/28 21:37:45 tedu Exp $ */ /* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */ /*- @@ -390,8 +390,7 @@ remglob2(char *argv[], int doswitch, char **errbuf, FILE **ftemp, char *type) if (*ftemp == NULL) { int len; - if ((cp = getenv("TMPDIR")) == NULL || *cp == '\0') - cp = _PATH_TMP; + cp = _PATH_TMP; len = strlen(cp); if (len + sizeof(TMPFILE) + (cp[len-1] != '/') > sizeof(temp)) { warnx("unable to create temporary file: %s", diff --git a/usr.bin/mail/mail.1 b/usr.bin/mail/mail.1 index f19780b4e9d..ffc3f1689a7 100644 --- a/usr.bin/mail/mail.1 +++ b/usr.bin/mail/mail.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mail.1,v 1.75 2015/09/07 15:28:06 sobrado Exp $ +.\" $OpenBSD: mail.1,v 1.76 2016/07/28 21:37:45 tedu Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)mail.1 8.8 (Berkeley) 4/28/95 .\" -.Dd $Mdocdate: September 7 2015 $ +.Dd $Mdocdate: July 28 2016 $ .Dt MAIL 1 .Os .Sh NAME @@ -1139,8 +1139,6 @@ command and the escape. A default shell is used if this option is not defined. -.It Ev TMPDIR -Directory in which temporary files are stored. .It Ev VISUAL Pathname of the text editor to use in the .Ic visual diff --git a/usr.bin/mail/temp.c b/usr.bin/mail/temp.c index e3c88b2c7d3..0f25855c1c7 100644 --- a/usr.bin/mail/temp.c +++ b/usr.bin/mail/temp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: temp.c,v 1.16 2015/10/16 17:56:07 mmcc Exp $ */ +/* $OpenBSD: temp.c,v 1.17 2016/07/28 21:37:45 tedu Exp $ */ /* $NetBSD: temp.c,v 1.5 1996/06/08 19:48:42 christos Exp $ */ /* @@ -46,8 +46,7 @@ tinit(void) { char *cp; - if ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0') - tmpdir = _PATH_TMP; + tmpdir = _PATH_TMP; if ((tmpdir = strdup(tmpdir)) == NULL) err(1, "strdup"); diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c index b03586e9a5b..667ad69d867 100644 --- a/usr.bin/mg/fileio.c +++ b/usr.bin/mg/fileio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fileio.c,v 1.101 2016/07/04 03:24:48 guenther Exp $ */ +/* $OpenBSD: fileio.c,v 1.102 2016/07/28 21:37:45 tedu Exp $ */ /* This file is in the public domain. */ @@ -664,7 +664,7 @@ backuptohomedir(int f, int n) /* * For applications that use mg as the editor and have a desire to keep - * '~' files in the TMPDIR, toggle the location: /tmp | ~/.mg.d + * '~' files in /tmp, toggle the location: /tmp | ~/.mg.d */ int toggleleavetmp(int f, int n) @@ -681,19 +681,11 @@ toggleleavetmp(int f, int n) int bkupleavetmp(const char *fn) { - char *tmpdir, *tmp = NULL; + char *tmp = NULL; if (!leavetmp) return(FALSE); - if((tmpdir = getenv("TMPDIR")) != NULL && *tmpdir != '\0') { - tmp = strstr(fn, tmpdir); - if (tmp == fn) - return (TRUE); - - return (FALSE); - } - tmp = strstr(fn, "/tmp"); if (tmp == fn) return (TRUE); diff --git a/usr.bin/mg/mg.1 b/usr.bin/mg/mg.1 index 391abca2ec1..96bc62ae8f8 100644 --- a/usr.bin/mg/mg.1 +++ b/usr.bin/mg/mg.1 @@ -1,7 +1,7 @@ -.\" $OpenBSD: mg.1,v 1.104 2016/04/14 17:05:32 lum Exp $ +.\" $OpenBSD: mg.1,v 1.105 2016/07/28 21:37:45 tedu Exp $ .\" This file is in the public domain. .\" -.Dd $Mdocdate: April 14 2016 $ +.Dd $Mdocdate: July 28 2016 $ .Dt MG 1 .Os .Sh NAME @@ -94,8 +94,8 @@ working directory, or all backups can be moved to a .Pa ~/.mg.d directory where files retain their path name to retain uniqueness. Use the backup-to-home-directory to alternate between these two locations. -Further, if any application creates backup files in the -.Ev TMPDIR , +Further, if any application creates backup files in +.Pa /tmp , these can be left with the leave-tmpdir-backups command. .Sh TAGS .Nm @@ -661,8 +661,8 @@ Delete forward words. .It leave-tmpdir-backups Modifies the behaviour of backup-to-home-directory. -Backup files that would normally reside in the system -.Ev TMPDIR +Backup files that would normally reside in +.Pa /tmp are left there and not moved to the .Pa ~/.mg.d directory. -- 2.20.1