summaryrefslogtreecommitdiffstats
path: root/c_random.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-07-01 10:01:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-07-01 10:01:25 +0000
commitc0072ad88a89ffade62dde1ee94c66a0be439ec5 (patch)
tree56712b726ed37608871c27a5de7b82a8b69b4a27 /c_random.sh
parentRemoving changes outside of debian directory. (diff)
downloadsamhain-c0072ad88a89ffade62dde1ee94c66a0be439ec5.tar.xz
samhain-c0072ad88a89ffade62dde1ee94c66a0be439ec5.zip
Merging upstream version 4.4.10.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'c_random.sh')
-rwxr-xr-xc_random.sh11
1 files changed, 6 insertions, 5 deletions
diff --git a/c_random.sh b/c_random.sh
index cc863aa..a51466e 100755
--- a/c_random.sh
+++ b/c_random.sh
@@ -15,7 +15,7 @@ rnd_tst=no
if test -r "/dev/urandom"; then
if test -c "/dev/urandom"; then
dd if=/dev/urandom ibs=1 count=4 > my_random_file 2>/dev/null
- nsum=`sum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
+ nsum=`cksum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
if test x$nsum != x; then
rnd_tst=yes
fi
@@ -26,7 +26,7 @@ if test x$rnd_tst = xno; then
if test -r "/dev/srandom"; then
if test -c "/dev/srandom"; then
dd if=/dev/srandom ibs=1 count=4 > my_random_file 2>/dev/null
- nsum=`sum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
+ nsum=`cksum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
if test x$nsum != x; then
rnd_tst=yes
fi
@@ -217,16 +217,17 @@ if test x$rnd_tst = xno; then
/usr/local/bin/procinfo -a >> my_random_file 2>/dev/null
fi
#
- nsum=`sum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
+ nsum=`cksum ./my_random_file | awk '{print $1 }' | sed 's%^0*%%g' 2>/dev/null`
#
fi
#
-# 'sum' is portable, but only 16 bit
+# 'cksum' is more portable than 'sum', but 32 bit
#
/bin/rm -f ./my_random_file 2>/dev/null
-echo $nsum
+final=`expr $nsum \% 65536`
+echo $final