summaryrefslogtreecommitdiff
path: root/startx.cpp
diff options
context:
space:
mode:
authorJeremy C. Reed <reed@tx.reedmedia.net>2008-03-15 18:23:45 -0500
committerJeremy C. Reed <reed@tx.reedmedia.net>2008-03-15 18:23:45 -0500
commit8c52bd4509b7fe5a74026b5bc638d59add9e8945 (patch)
treedeff6290b0b7eba19f368a991493245148d57329 /startx.cpp
parent062524614fdd4f11f32ba3d054f7fc16b9bc5f12 (diff)
Use /dev/urandom for cookie it it exists
else fall back to /dev/random. Not doing in configure.ac because can't easily check for existence when doing cross-builds. (Alternative would be to define this for every operating system in configure.ac. Currently only is defined for OpenBSD. Systems that have mcookie also will not be effected.)
Diffstat (limited to 'startx.cpp')
-rw-r--r--startx.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/startx.cpp b/startx.cpp
index c31fd7f..c31ae10 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -243,7 +243,11 @@ if [ x"$enable_xauth" = x1 ] ; then
#if defined(HAS_COOKIE_MAKER) && defined(MK_COOKIE)
mcookie=`MK_COOKIE`
#else
- mcookie=`dd if=/dev/random bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"`
+ if [ -r /dev/urandom ]; then
+ mcookie=`dd if=/dev/urandom bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"`
+ else
+ mcookie=`dd if=/dev/random bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"`
+ fi
if test x"$mcookie" = x; then
echo "Couldn't create cookie"
exit 1