Skip to content

Commit 2f606ed

Browse files
committed
Remove another useless, counterproductive srandom() call.
1 parent 48beecd commit 2f606ed

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

contrib/chkpass/chkpass.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* darcy@druid.net
55
* http://www.druid.net/darcy/
66
*
7-
* $Id: chkpass.c,v 1.10 2003/07/24 17:52:12 tgl Exp $
7+
* $Id: chkpass.c,v 1.11 2003/09/07 15:27:25 tgl Exp $
88
* best viewed with tabs set to 4
99
*/
1010

@@ -69,7 +69,6 @@ chkpass_in(PG_FUNCTION_ARGS)
6969
char *str = PG_GETARG_CSTRING(0);
7070
chkpass *result;
7171
char mysalt[4];
72-
static bool random_initialized = false;
7372
static char salt_chars[] =
7473
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
7574

@@ -93,12 +92,6 @@ chkpass_in(PG_FUNCTION_ARGS)
9392

9493
result = (chkpass *) palloc(sizeof(chkpass));
9594

96-
if (!random_initialized)
97-
{
98-
srandom((unsigned int) time(NULL));
99-
random_initialized = true;
100-
}
101-
10295
mysalt[0] = salt_chars[random() & 0x3f];
10396
mysalt[1] = salt_chars[random() & 0x3f];
10497
mysalt[2] = 0; /* technically the terminator is not

0 commit comments

Comments
 (0)