mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-01 05:52:41 +07:00
Makefile: do not use a temporary file to test iconv
Using a predictible temporary file name in /tmp is a security risk. It
could be used to overwrite or delete arbitrary files through a symlink,
possibly as root when running for instance "sudo make install".
Use "-o /dev/null" instead, which is supported by at least clang and
gcc.
Fixes: 68bda21952
This commit is contained in:
committed by
Michal Suchánek
parent
039d0901bc
commit
927568e956
@@ -177,15 +177,13 @@ ifndef LIBICONV
|
||||
ICONV_TEST := $(shell printf '%s\n' \
|
||||
'#include <iconv.h>' \
|
||||
'int main() { iconv_t cd = iconv_open("UTF-8", "ASCII"); return 0; }' \
|
||||
| $(CC) $(ALL_CPPFLAGS) -x c - -o /tmp/lm_sensors_iconv_test 2>/dev/null && echo "builtin" || echo "external")
|
||||
| $(CC) $(ALL_CPPFLAGS) -x c - -o /dev/null 2>/dev/null && echo "builtin" || echo "external")
|
||||
|
||||
ifeq ($(ICONV_TEST),builtin)
|
||||
LIBICONV :=
|
||||
else
|
||||
LIBICONV := -liconv
|
||||
endif
|
||||
|
||||
$(shell rm -f /tmp/lm_sensors_iconv_test)
|
||||
endif
|
||||
|
||||
EXLDFLAGS := -Wl,-rpath,$(LIBDIR) $(ALL_LDFLAGS)
|
||||
|
||||
Reference in New Issue
Block a user