[PATCH] scripts/trylink: use portable invocation of mktemp

andrew at andrewoates.com andrew at andrewoates.com
Thu Jul 7 02:09:00 UTC 2016


From: Andrew Oates <aoates at google.com>

On OS X, mktemp can't be run without any arguments (it requires a
template).  This version has the same behavior on both OS X and Linux.

Signed-off-by: Andrew Oates <aoates at google.com>
---
 scripts/trylink | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/trylink b/scripts/trylink
index 145df99..59194fc 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -46,7 +46,7 @@ try() {
 }
 
 check_cc() {
-    local tempname="$(mktemp)"
+    local tempname="$(mktemp /tmp/tmp.XXXXXXXXXX)"
     local r
     echo "int main(int argc,char**argv){return argv?argc:0;}" >"$tempname".c
     # Can use "-o /dev/null", but older gcc tend to *unlink it* on failure! :(
@@ -61,7 +61,7 @@ check_cc() {
 }
 
 check_libc_is_glibc() {
-    local tempname="$(mktemp)"
+    local tempname="$(mktemp /tmp/tmp.XXXXXXXXXX)"
     local r
     echo "\
 	#include <stdlib.h>
-- 
2.5.0



More information about the busybox mailing list