=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/plugin/oxmisc.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -p -r1.20 -r1.21 --- OpenXM/src/kan96xx/plugin/oxmisc.c 2004/03/08 08:24:42 1.20 +++ OpenXM/src/kan96xx/plugin/oxmisc.c 2004/09/16 23:53:45 1.21 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/plugin/oxmisc.c,v 1.19 2004/02/25 23:14:35 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/plugin/oxmisc.c,v 1.20 2004/03/08 08:24:42 takayama Exp $ */ #include #include #include @@ -878,14 +878,16 @@ char *oxGenPass(void) { static int seed = 0; long p; char *s; - int i; + int i,n; if (seed == 0) { seed = (int) time(NULL) + (int) &p; srandom((unsigned int) seed); } - for (i=0; i < ((int) &p) % 100 ; i++) random(); - p = random(); s = (char *)malloc(128*sizeof(char)); + if (s == NULL) { fprintf(stderr,"No more memory.\n"); return(s); } + n = (((int) s) + (int) time(NULL)) % 100; + for (i=0; i < n ; i++) random(); + p = random(); sprintf(s,"%ld",p); return(s); }