From 4ff9295f462c4f753902e6e520f645cad305aec6 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 30 Dec 2015 20:54:19 -0600 Subject: Don't let mktemp -q /path/to/file delete arbitrary files, and don't have "mktemp -u > /dev/full" leave file around. --- toys/lsb/mktemp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'toys/lsb') diff --git a/toys/lsb/mktemp.c b/toys/lsb/mktemp.c index f1f9d885..118daccf 100644 --- a/toys/lsb/mktemp.c +++ b/toys/lsb/mktemp.c @@ -48,8 +48,10 @@ void mktemp_main(void) if (toys.optflags & FLAG_q) toys.exitval = 1; else perror_exit("Failed to create %s %s/%s", d_flag ? "directory" : "file", TT.tmpdir, template); - } else xputs(template); - if (toys.optflags & FLAG_u) unlink(template); + } else { + if (toys.optflags & FLAG_u) unlink(template); + xputs(template); + } if (CFG_TOYBOX_FREE) free(template); } -- cgit v1.2.3