expect/expect-5.32.2-random.patch
Petr Šabata c89f70f1b7 RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/expect#e13e9cb80d4c0f7031b80814385a34effd4ee7c4
2020-10-15 00:10:59 +02:00

20 lines
655 B
Diff

diff -up expect-5.44.1.15/example/mkpasswd.orig expect-5.44.1.15/example/mkpasswd
--- expect-5.44.1.15/example/mkpasswd.orig 2010-03-08 16:01:05.518378075 +0100
+++ expect-5.44.1.15/example/mkpasswd 2010-03-08 16:01:27.408388162 +0100
@@ -92,7 +92,14 @@ proc insert {pvar char} {
}
proc rand {m} {
- expr {int($m*rand())}
+ set device /dev/urandom ;# /dev/random can block
+ set fileId [open $device r]
+ binary scan [read $fileId 4] i1 number
+ set clipped [expr $number % $m]
+# puts "number is $number"
+# puts "clipped is $clipped"
+ close $fileId
+ return $clipped
}
# choose left or right starting hand