I can reproduce this bug here on sid. Your patch seems to work for me, but I'm not sure whether it's the best solution to just put the process in the background. The attached patch uses a additional dcop call to check whether kscreensaver is already running and only calls 'lock' in case it's not.
Cheers, Tobias
--- lock.orig 2006-09-09 10:39:56.000000000 +0200 +++ lock 2006-09-09 10:42:10.000000000 +0200 @@ -46,8 +46,12 @@ # send the lock command to all sessions for session in $avail_sessions; do vecho 1 "Locking $session" - # dev/null because dcop warns if it can't connect to X (this is normal!) - dcop --session "$session" --all-users kdesktop KScreensaverIface lock > /dev/null 2>&1 + + already_blanked=`dcop --session "$session" --all-users kdesktop KScreensaverIface isBlanked` + if [ x"$already_blanked" != "xfalse" ] ; then + # dev/null because dcop warns if it can't connect to X (this is normal!) + dcop --session "$session" --all-users kdesktop KScreensaverIface lock > /dev/null 2>&1 + fi done # returning 0 because dcop warns if it can't connect to X (this is normal!)