[lxc-devel] [PATCH 11/17] Use srand/rand instead of initstate/random
Stéphane Graber
stgraber at ubuntu.com
Fri Aug 16 15:13:57 UTC 2013
initstate/random doesn't work on bionic, srand/rand works on everything,
so let's use that.
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
src/lxc/conf.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 867a150..3d99469 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -288,7 +288,6 @@ static char *mkifname(char *template)
int i = 0;
FILE *urandom;
unsigned int seed;
- char randstate[2048];
struct ifaddrs *ifaddr, *ifa;
int ifexists = 0;
@@ -304,7 +303,7 @@ static char *mkifname(char *template)
}
else
seed = time(0);
- initstate(seed, randstate, 256);
+ srand(seed);
/* Generate random names until we find one that doesn't exist */
while(1) {
@@ -316,7 +315,7 @@ static char *mkifname(char *template)
for (i = 0; i < strlen(name); i++) {
if (name[i] == 'X') {
- name[i] = padchar[random() % (strlen(padchar) - 1)];
+ name[i] = padchar[rand() % (strlen(padchar) - 1)];
}
}
--
1.8.3.2
More information about the lxc-devel
mailing list