From 8c52bd4509b7fe5a74026b5bc638d59add9e8945 Mon Sep 17 00:00:00 2001 From: "Jeremy C. Reed" Date: Sat, 15 Mar 2008 18:23:45 -0500 Subject: 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.) --- startx.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'startx.cpp') 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 -- cgit v1.2.3