]> The Tcpdump Group git mirrors - libpcap/commitdiff
CI: Get randomness right in mktempdir_diy(). [skip ci]
authorDenis Ovsienko <[email protected]>
Wed, 4 Aug 2021 00:10:43 +0000 (01:10 +0100)
committerDenis Ovsienko <[email protected]>
Wed, 4 Aug 2021 00:10:43 +0000 (01:10 +0100)
Same as in tcpslice.

build_common.sh

index a803957a9da16f1ebc7639fb24f71b808596c618..21d62b835dd8bdf2d8f0e22c70087481f9512219 100644 (file)
@@ -12,7 +12,7 @@ mktempdir_diy() {
         # /bin/sh implements $RANDOM in AIX 7, but not in Solaris before 11,
         # thus use dd and od instead.
         # shellcheck disable=SC2006
-        mktempdir_diy_suffix=`dd if=/dev/urandom bs=1 count=4 2>/dev/null | od -t x -A n | head -1 | tr -d '\t '`
+        mktempdir_diy_suffix=`dd if=/dev/urandom bs=4 count=1 2>/dev/null | od -t x -A n | head -1 | tr -d '\t '`
         [ -z "$mktempdir_diy_suffix" ] && return 1
         mktempdir_diy_path="${TMPDIR:-/tmp}/${1:?}.${mktempdir_diy_suffix}"
         # "test -e" would be more appropriate, but it is not available in
@@ -23,7 +23,7 @@ mktempdir_diy() {
             echo "$mktempdir_diy_path"
             break
         fi
-        # Try again (AIX /dev/urandom returns zeroes quite often).
+        # Try again (very unlikely, just in case).
     done
 }