Группа :: Работа с текстами
Пакет: jot
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: jot-urandom.patch
Скачать
Скачать
Only in jot-1.37.old: jot
diff -ur jot-1.37.old/jot.1 jot-1.37/jot.1
--- jot-1.37.old/jot.1 2007-11-08 02:56:12 +0300
+++ jot-1.37/jot.1 2007-11-08 03:15:21 +0300
@@ -139,12 +139,9 @@
.Tn ASCII .
The last argument must be a real number.
.Pp
-Random numbers are obtained through
-.Xr arc4random 3
-when no seed is specified,
-and through
-.Xr random 3
-when a seed is given.
+When no seed is specified,
+.Xr /dev/urandom
+is used for seed picking.
When
.Nm
is asked to generate random integers or characters with begin
diff -ur jot-1.37.old/jot.c jot-1.37/jot.c
--- jot-1.37.old/jot.c 2007-11-08 02:56:12 +0300
+++ jot-1.37/jot.c 2007-11-08 03:11:30 +0300
@@ -267,11 +267,15 @@
if (reps == 0)
infinity = true;
if (randomize) {
- if (use_random) {
- srandom((unsigned long)s);
- divisor = (double)INT32_MAX + 1;
- } else
- divisor = (double)UINT32_MAX + 1;
+ if (!use_random) {
+ if((ch=open("/dev/urandom",0))==-1 || read(ch,&i,sizeof(i))==-1)
+ errx(1, "cannot read /dev/urandom");
+ close(ch);
+ use_random=true;
+ s=i;
+ }
+ srandom((unsigned long)s);
+ divisor = (double)INT32_MAX + 1;
/*
* Attempt to DWIM when the user has specified an