[PATCH v2] sparsec: simplify & portable use of mktemp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Most manpages for mktemp(1) specify that the 'XXXXXX' part of the
template must be at the end (of course, the GNU's version accept
it anywhere). At least the busybox's version used by Alpine Linux
tries to enforce that and fails in sparse current use of it:
	tmp.XXXXXX.{llvm,o}

OTOH, the llc command can take its input from stdin and so there
is no need to have 2 temp files that need to be distinguished.

Fix the portability problem by feeding llc via stdin, which removes
the need for the first temp file, and using 'tmp.XXXXXX' as template
for the remaining one.

Fixes: a410611d7 "(llvm: fix creation of sparsec's tmp files")
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---

Changes since v1:
- remove the need to have 2 temp file by using a pipe instead.


 sparsec | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/sparsec b/sparsec
index e421776e2..fae49dab4 100755
--- a/sparsec
+++ b/sparsec
@@ -29,14 +29,12 @@ while [ $# -gt 0 ]; do
 	shift
 done
 
-TMPLLVM=`mktemp -t tmp.XXXXXX.llvm`
-TMPFILE=`mktemp -t tmp.XXXXXX.o`
+TMPFILE=`mktemp -t tmp.XXXXXX`
 
-$DIRNAME/sparse-llvm $SPARSEOPTS > $TMPLLVM
 
 LLC=`"${LLVM_CONFIG:-llvm-config}" --bindir`/llc
 
-$LLC -o - $TMPLLVM | as -o $TMPFILE
+$DIRNAME/sparse-llvm $SPARSEOPTS | $LLC | as -o $TMPFILE
 
 if [ $NEED_LINK -eq 1 ]; then
 	if [ -z $OUTFILE ]; then
@@ -50,5 +48,3 @@ else
 	fi
 	mv $TMPFILE $OUTFILE
 fi
-
-rm -f $TMPLLVM
-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux