tags 464989 patch upstream
thanks

Hi,

I made a patch (attached) which works around this bashism in
hibernate.sh. It's also reported upstream [1].


- Werner

[1] http://bugzilla.tuxonice.net/show_bug.cgi?id=361

diff -ruN hibernate-1.97.orig/hibernate.sh hibernate-1.97/hibernate.sh
--- hibernate-1.97.orig/hibernate.sh	2007-09-30 15:54:58.000000000 +0200
+++ hibernate-1.97/hibernate.sh	2008-02-21 16:15:54.967014034 +0100
@@ -389,10 +389,20 @@
 	    local CNT
 	    local D
 	    local FN
+	    local RND1
+	    local RND2
 	    CNT=1
+	    if [ -z "$RANDOM" ] ; then
+	    	# A fix for shells that do not have this bash feature
+		RND1=$(dd if=/dev/urandom count=1 2>/dev/null|cksum|cut -c"1-5")
+		RND2=$(dd if=/dev/urandom count=1 2>/dev/null|cksum|cut -c"1-5")
+	    else
+	        RND1=$RANDOM
+		RND2=$RANDOM
+	    fi
 	    while true ; do
 		D=`date +%s`
-		FN=/tmp/tmp.hibernate.$$$D$RANDOM$RANDOM$CNT
+		FN=/tmp/tmp.hibernate.$$$D$RND1$RND2$CNT
 		[ -f $FN ] && continue
 		touch $FN && break
 		CNT=$(($CNT+1))

Reply via email to