aboutsummaryrefslogtreecommitdiff
path: root/src/lxc
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2012-08-03 17:15:00 -0600
committerEric Blake <eblake@redhat.com>2012-08-06 08:15:13 -0600
commit87de27b7f9296c90b6f4e35eeb5448db491dcba2 (patch)
tree9f9ca1dc0ba8a8f5d9bbab97547642ac55a5d526 /src/lxc
parentbuild: drop conditional use of mdns code (diff)
downloadlibvirt-87de27b7f9296c90b6f4e35eeb5448db491dcba2.tar.gz
libvirt-87de27b7f9296c90b6f4e35eeb5448db491dcba2.tar.bz2
libvirt-87de27b7f9296c90b6f4e35eeb5448db491dcba2.zip
virrandom: make virRandomInitialize an automatic one-shot
All callers used the same initialization seed (well, the new viratomictest forgot to look at getpid()); so we might as well make this value automatic. And while it may feel like we are giving up functionality, I documented how to get it back in the unlikely case that you actually need to debug with a fixed pseudo-random sequence. I left that crippled by default, so that a stray environment variable doesn't cause a lack of randomness to become a security issue. * src/util/virrandom.c (virRandomInitialize): Rename... (virRandomOnceInit): ...and make static, with one-shot call. Document how to do fixed-seed debugging. * src/util/virrandom.h (virRandomInitialize): Drop prototype. * src/libvirt_private.syms (virrandom.h): Don't export it. * src/libvirt.c (virInitialize): Adjust caller. * src/lxc/lxc_controller.c (main): Likewise. * src/security/virt-aa-helper.c (main): Likewise. * src/util/iohelper.c (main): Likewise. * tests/seclabeltest.c (main): Likewise. * tests/testutils.c (virtTestMain): Likewise. * tests/viratomictest.c (mymain): Likewise.
Diffstat (limited to 'src/lxc')
-rw-r--r--src/lxc/lxc_controller.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 56ed7d319..8ff925e56 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2010-2012 Red Hat, Inc.
* Copyright IBM Corp. 2008
*
* lxc_controller.c: linux container process controller
@@ -1480,8 +1480,7 @@ int main(int argc, char *argv[])
if (setlocale(LC_ALL, "") == NULL ||
bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
- textdomain(PACKAGE) == NULL ||
- virRandomInitialize(time(NULL) ^ getpid())) {
+ textdomain(PACKAGE) == NULL) {
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
exit(EXIT_FAILURE);
}