strfry patch
James A Morrison
ja2morri@student.math.uwaterloo.ca
Sat Mar 9 14:15:00 GMT 2002
Hi,
To provide the illusion of more randomness, strfry now seeds it's rng
with time % pid so while(sleep 0.1); do ./strfry "Fun stff"; done
will provide a differnt fried string for each process.
Index: strfry.c
===================================================================
RCS file: /cvs/glibc/libc/string/strfry.c,v
retrieving revision 1.6
diff -u -r1.6 strfry.c
--- strfry.c 2001/07/06 04:55:41 1.6
+++ strfry.c 2002/03/09 22:02:04
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1996, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1996, 1999, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -31,7 +31,7 @@
{
static char state[32];
rdata.state = NULL;
- __initstate_r (time ((time_t *) NULL), state, sizeof (state), &rdata);
+ __initstate_r (time ((time_t *) NULL) % getpid (), state, sizeof (state), &rdata);
init = 1;
}
More information about the Libc-alpha
mailing list