aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Merlin <louis@srlabs.de>2024-05-02 17:19:37 +0200
committerLouis Merlin <louis@srlabs.de>2024-05-02 17:19:37 +0200
commit3c0448305b97ed2491b51814443eba6792df7dc7 (patch)
tree13092674a18d6a3e7cfbf63e110fe0e7652dfc9f
parenta6029a10cc672034789ec6bee56119c0901b651a (diff)
downloadAFLplusplus-3c0448305b97ed2491b51814443eba6792df7dc7.tar.gz
Guard /proc/uptime cat with a uname check
-rwxr-xr-xafl-whatsup8
1 files changed, 7 insertions, 1 deletions
diff --git a/afl-whatsup b/afl-whatsup
index 5f5255f5..19841755 100755
--- a/afl-whatsup
+++ b/afl-whatsup
@@ -111,7 +111,13 @@ if [ -z "$NO_COLOR" ]; then
RESET="$NC"
fi
-CUR_TIME=`cat /proc/uptime | awk '{printf "%.0f\n", $1}'`
+PLATFORM=`uname -s`
+if [ "$PLATFORM" = "Linux" ] ; then
+ CUR_TIME=`cat /proc/uptime | awk '{printf "%.0f\n", $1}'`
+else
+ # This will lead to inacurate results but will prevent the script from breaking on platforms other than Linux
+ CUR_TIME=`date +%s`
+fi
TMP=`mktemp -t .afl-whatsup-XXXXXXXX` || TMP=`mktemp -p /data/local/tmp .afl-whatsup-XXXXXXXX` || TMP=`mktemp -p /data/local/tmp .afl-whatsup-XXXXXXXX` || exit 1
trap "rm -f $TMP" 1 2 3 13 15