diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-06-07 00:57:37 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-06-21 07:36:21 +0200 |
| commit | e97275d8e5c44482b3627c3f303addd0631cfd6d (patch) | |
| tree | e50e1bf58c744eb9c3e9ae9e65863aa5d3d329c4 | |
| parent | 38a03a5ffc74c55536cf6d86a94b9758a1db076f (diff) | |
| download | sparse-dev-e97275d8e5c44482b3627c3f303addd0631cfd6d.tar.gz | |
sparsec: simplify & portable use of mktemp
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@gmail.com>
| -rwxr-xr-x | sparsec | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -29,20 +29,19 @@ 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 OUTFILE=a.out fi gcc $TMPFILE -o $OUTFILE + rm -f $TMPFILE else if [ -z $OUTFILE ]; then echo "`basename $0`: no output file" @@ -50,5 +49,3 @@ else fi mv $TMPFILE $OUTFILE fi - -rm -f $TMPLLVM |
