changeset 1729:801eba977271

Fix mktemp when TMPDIR is set to empty string, reported by Kylie McClain.
author Rob Landley <rob@landley.net>
date Wed, 11 Mar 2015 23:05:54 -0500
parents d7e43cc0f525
children 90a7ed7ec30e
files toys/lsb/mktemp.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/toys/lsb/mktemp.c	Tue Mar 10 14:37:03 2015 -0500
+++ b/toys/lsb/mktemp.c	Wed Mar 11 23:05:54 2015 -0500
@@ -38,7 +38,7 @@
   if (!template) template = "tmp.XXXXXX";
 
   if (!TT.tmpdir) TT.tmpdir = getenv("TMPDIR");
-  if (!TT.tmpdir) TT.tmpdir = "/tmp";
+  if (!TT.tmpdir || !*TT.tmpdir) TT.tmpdir = "/tmp";
 
   template = strchr(template, '/') ? xstrdup(template)
              : xmprintf("%s/%s", TT.tmpdir, template);