Index: debian/patches/03-authatieventsd.sh.diff
===================================================================
--- debian/patches/03-authatieventsd.sh.diff	(revision 635)
+++ debian/patches/03-authatieventsd.sh.diff	(working copy)
@@ -1,8 +1,9 @@
 # Make the authatieventsd.sh working on Debian.
 
-diff -Naur fglrx-driver-11-6.orig/common/etc/ati/authatieventsd.sh fglrx-driver-11-6/common/etc/ati/authatieventsd.sh
---- fglrx-driver-11-6.orig/common/etc/ati/authatieventsd.sh	2011-06-01 23:20:56.000000000 +0200
-+++ fglrx-driver-11-6/common/etc/ati/authatieventsd.sh	2011-07-04 20:13:52.841207585 +0200
+Index: b/common/etc/ati/authatieventsd.sh
+===================================================================
+--- a/common/etc/ati/authatieventsd.sh	2011-06-01 23:20:56.000000000 +0200
++++ b/common/etc/ati/authatieventsd.sh	2011-07-04 21:48:36.126352637 +0200
 @@ -42,6 +42,16 @@
          return 0
      fi
@@ -35,7 +36,7 @@
      done
  
      # Couldn't find the key
-@@ -84,15 +96,29 @@
+@@ -84,15 +96,23 @@
      grant)
          GetServerAuthFile $2 || exit -1
          DISP_AUTH_KEY=`xauth -f $SERVER_AUTH_FILE list | grep $DISP_SEARCH_STRING | awk '{ print $3 }'`
@@ -43,26 +44,20 @@
 -            xauth -f $3 add $2 . $DISP_AUTH_KEY || exit -1
 -        else
 -            exit -1
-+	if [ `pinky -fs | awk '{ if ($3 == "'$2'" || $(NF) == "'$2'" ) { print $1; exit; } }'` ]; then
-+		user=`pinky -fs | awk '{ if ($3 == "'$2'" || $(NF) == "'$2'" ) { print $1; exit; } }'`
-+		if [ -n "$DISP_AUTH_KEY" ]; then
-+					su $user -c "echo \"$2 . $DISP_AUTH_KEY\" | xauth -f $3 merge - || exit -1"
-+	        else
-+        	    exit -1
-+		fi
++	test -n "$DISP_AUTH_KEY" || exit -1
++	user="$(pinky -fs | awk '{ if ($3 == "'$2'" || $(NF) == "'$2'" ) { print $1; exit; } }')"
++	if [ -n "$user" ]; then
++		echo "$2 . $DISP_AUTH_KEY" | su $user -c "xauth -f $3 merge - || exit -1"
 +	else
-+		if [ -n "$DISP_AUTH_KEY" ]; then
-+        		    xauth -f $3 add $2 . $DISP_AUTH_KEY || exit -1
-+	        else
-+        	    exit -1
-+		fi
++		echo "$2 . $DISP_AUTH_KEY" | xauth -f $3 add - || exit -1
          fi
++	unset DISP_AUTH_KEY
          ;;
  
      revoke)
 -        xauth -f $3 remove $2 || exit -1
-+	if [ `pinky -fs | awk '{ if ($3 == "'$2'" || $(NF) == "'$2'" ) { print $1; exit; } }'` ]; then
-+		user=`pinky -fs | awk '{ if ($3 == "'$2'" || $(NF) == "'$2'" ) { print $1; exit; } }'`
++	user="$(pinky -fs | awk '{ if ($3 == "'$2'" || $(NF) == "'$2'" ) { print $1; exit; } }')"
++	if [ -n "$user" ]; then
 +		su $user -c "xauth -f $3 remove $2" || exit -1
 +	else
 +		xauth -f $3 remove $2 || exit -1
