From de6efe2b2c424a322066455f3f586065bf4cea4d Mon Sep 17 00:00:00 2001 From: James Slagle Date: Wed, 31 Jul 2013 14:26:05 -0400 Subject: [PATCH] Ensure $TMP_BUILD_DIR is actually created. Previously if mktemp failed in function mk_build_dir, die was not called. The check for the exit code was actually checking that the previous export statement completed successfully, not the call to mktemp. Change-Id: I477a2ce75c87c8167883ce7aa342e93c40770e29 --- lib/common-functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/common-functions b/lib/common-functions index c6382d24..78fdb8f6 100644 --- a/lib/common-functions +++ b/lib/common-functions @@ -24,8 +24,9 @@ function tmpfs_check() { } function mk_build_dir () { - export TMP_BUILD_DIR=$(mktemp -t -d --tmpdir=${TMP_DIR:-/tmp} image.XXXXXXXX) + TMP_BUILD_DIR=$(mktemp -t -d --tmpdir=${TMP_DIR:-/tmp} image.XXXXXXXX) [ $? -eq 0 ] || die "Failed to create tmp directory" + export TMP_BUILD_DIR if tmpfs_check ; then sudo mount -t tmpfs tmpfs $TMP_BUILD_DIR fi