aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2020-09-18 09:02:43 +0200
committerhexcoder- <heiko@hexco.de>2020-09-18 09:02:43 +0200
commit9eed8fe58895fd4a20aa7b5f180b1bfaebf42cd7 (patch)
tree0db810b88feb7381058eae3eab13a72ddc4a4611
parent5241d1221b7bccd7f63f872653e597f33948423a (diff)
downloadafl++-9eed8fe58895fd4a20aa7b5f180b1bfaebf42cd7.tar.gz
portability: type -> command -v, compiler warnings
-rw-r--r--GNUmakefile.gcc_plugin2
-rw-r--r--GNUmakefile.llvm10
-rw-r--r--src/afl-fuzz-init.c4
3 files changed, 9 insertions, 7 deletions
diff --git a/GNUmakefile.gcc_plugin b/GNUmakefile.gcc_plugin
index fe2dc266..55b79182 100644
--- a/GNUmakefile.gcc_plugin
+++ b/GNUmakefile.gcc_plugin
@@ -103,7 +103,7 @@ endif
.PHONY: test_deps
test_deps:
@echo "[*] Checking for working '$(CC)'..."
- @type $(CC) >/dev/null 2>&1 || ( echo "[-] Oops, can't find '$(CC)'. Make sure that it's in your \$$PATH (or set \$$CC and \$$CXX)."; exit 1 )
+ @command -v $(CC) >/dev/null 2>&1 || ( echo "[-] Oops, can't find '$(CC)'. Make sure that it's in your \$$PATH (or set \$$CC and \$$CXX)."; exit 1 )
# @echo "[*] Checking for gcc for plugin support..."
# @$(CC) -v 2>&1 | grep -q -- --enable-plugin || ( echo "[-] Oops, this gcc has not been configured with plugin support."; exit 1 )
@echo "[*] Checking for gcc plugin development header files..."
diff --git a/GNUmakefile.llvm b/GNUmakefile.llvm
index 39ddba3c..11ed0bd6 100644
--- a/GNUmakefile.llvm
+++ b/GNUmakefile.llvm
@@ -116,9 +116,9 @@ ifeq "$(shell test -e $(CC) || echo 1 )" "1"
endif
# llvm-config --bindir may not providing a valid path, so ...
ifeq "$(shell test -e $(CXX) || echo 1 )" "1"
- # however we must ensure that this is not a "CC=gcc make"
+ # however we must ensure that this is not a "CXX=g++ make"
ifeq "$(shell command -v $(CXX) 2> /dev/null)" ""
- # we do not have a valid CC variable so we try alternatives
+ # we do not have a valid CXX variable so we try alternatives
ifeq "$(shell test -e '$(BIN_DIR)/clang++' && echo 1)" "1"
# we found one in the local install directory, lets use these
CXX = $(BIN_DIR)/clang++
@@ -175,10 +175,10 @@ endif
# Now it can happen that CC points to clang - but there is no clang on the
# system. Then we fall back to cc
#
-ifeq "$(shell type $(CC))" ""
+ifeq "$(shell command -v $(CC) 2>/dev/null)" ""
CC = cc
endif
-ifeq "$(shell type $(CXX))" ""
+ifeq "$(shell command -v $(CXX) 2>/dev/null)" ""
CXX = c++
endif
@@ -476,7 +476,7 @@ vpath % ..
%.8: %
@echo .TH $* 8 $(BUILD_DATE) "afl++" > ./$@
@echo .SH NAME >> ./$@
- @printf ".B $* \- " >> ../$@
+ @printf "%s" ".B $* \- " >> ../$@
@./$* -h 2>&1 | head -n 1 | sed -e "s/$$(printf '\e')[^m]*m//g" >> ../$@
@echo .B $* >> ./$@
@echo >> ./$@
diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c
index 29c8c6fa..cbac3822 100644
--- a/src/afl-fuzz-init.c
+++ b/src/afl-fuzz-init.c
@@ -311,7 +311,7 @@ void bind_to_free_cpu(afl_state_t *afl) {
}
- for (i = 0; i < proccount; i++) {
+ for (i = 0; i < (s32)proccount; i++) {
if (procs[i].p_cpuid < sizeof(cpu_used) && procs[i].p_pctcpu > 0)
cpu_used[procs[i].p_cpuid] = 1;
@@ -2182,6 +2182,8 @@ void check_cpu_governor(afl_state_t *afl) {
"drop.\n",
min / 1024, max / 1024);
FATAL("Suboptimal CPU scaling governor");
+#else
+ (void)afl;
#endif
}