Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37668201
en ru br
Репозитории ALT
S:12.3-alt1
5.1: 1.37-alt1
4.1: 1.37-alt1
www.altlinux.org/Changes

Группа :: Работа с текстами
Пакет: 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
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin