1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00

rand-related fixes

This commit is contained in:
Andrey A. Chernov 2001-04-23 09:55:03 +00:00
parent 56893991f5
commit 6472509188
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=41821
6 changed files with 63 additions and 9 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= mnogosearch
PORTVERSION= 3.1.12
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= www databases
MASTER_SITES= http://search.mnogo.ru/Download/

View File

@ -1,5 +1,23 @@
--- src/search.c.old Wed Feb 28 15:28:10 2001
+++ src/search.c Thu Apr 19 18:02:10 2001
--- src/search.c.orig Wed Feb 28 15:28:10 2001
+++ src/search.c Mon Apr 23 06:46:50 2001
@@ -431,7 +431,7 @@
s=str+1;
while((*s)&&(isdigit(*s)))s++;
j=atoi(UdmTrim(s,"= \t\r\n"));
- if((i>0)&&(i<MAXRANDOM)){
+ if((i>=0)&&(i<MAXRANDOM)){
frand=rand();
frand=frand/RAND_MAX*j;
Randoms[i]=frand;
@@ -1225,7 +1225,7 @@
int i;
time_t tclock;
tclock=time(0);
- srand((unsigned)tclock);
+ srand((unsigned)(tclock^(getpid()<<16)));
for(i=0;i<MAXRANDOM;i++)
Randoms[i]=0;
}
@@ -1269,7 +1269,8 @@
strcpy(template,env);

View File

@ -7,7 +7,7 @@
PORTNAME= mnogosearch
PORTVERSION= 3.1.12
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= www databases
MASTER_SITES= http://search.mnogo.ru/Download/

View File

@ -1,5 +1,23 @@
--- src/search.c.old Wed Feb 28 15:28:10 2001
+++ src/search.c Thu Apr 19 18:02:10 2001
--- src/search.c.orig Wed Feb 28 15:28:10 2001
+++ src/search.c Mon Apr 23 06:46:50 2001
@@ -431,7 +431,7 @@
s=str+1;
while((*s)&&(isdigit(*s)))s++;
j=atoi(UdmTrim(s,"= \t\r\n"));
- if((i>0)&&(i<MAXRANDOM)){
+ if((i>=0)&&(i<MAXRANDOM)){
frand=rand();
frand=frand/RAND_MAX*j;
Randoms[i]=frand;
@@ -1225,7 +1225,7 @@
int i;
time_t tclock;
tclock=time(0);
- srand((unsigned)tclock);
+ srand((unsigned)(tclock^(getpid()<<16)));
for(i=0;i<MAXRANDOM;i++)
Randoms[i]=0;
}
@@ -1269,7 +1269,8 @@
strcpy(template,env);

View File

@ -7,7 +7,7 @@
PORTNAME= mnogosearch
PORTVERSION= 3.1.12
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= www databases
MASTER_SITES= http://search.mnogo.ru/Download/

View File

@ -1,5 +1,23 @@
--- src/search.c.old Wed Feb 28 15:28:10 2001
+++ src/search.c Thu Apr 19 18:02:10 2001
--- src/search.c.orig Wed Feb 28 15:28:10 2001
+++ src/search.c Mon Apr 23 06:46:50 2001
@@ -431,7 +431,7 @@
s=str+1;
while((*s)&&(isdigit(*s)))s++;
j=atoi(UdmTrim(s,"= \t\r\n"));
- if((i>0)&&(i<MAXRANDOM)){
+ if((i>=0)&&(i<MAXRANDOM)){
frand=rand();
frand=frand/RAND_MAX*j;
Randoms[i]=frand;
@@ -1225,7 +1225,7 @@
int i;
time_t tclock;
tclock=time(0);
- srand((unsigned)tclock);
+ srand((unsigned)(tclock^(getpid()<<16)));
for(i=0;i<MAXRANDOM;i++)
Randoms[i]=0;
}
@@ -1269,7 +1269,8 @@
strcpy(template,env);