Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 8553 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/bin/keychain-orig (+47 lines)
Lines 325-330 Link Here
325
	fi
325
	fi
326
done
326
done
327
327
328
# Added 21-Feb-2003 kronenpj@netzero.net
329
# Try to play nice with an existing ssh-agent.
330
if [ "x$mypids" != "x" ]; then
331
	# Find the first one owned by $USE in /tmp
332
	mydirs=`/bin/ls -l /tmp/ | grep ssh- | grep $USER | head -1`
333
334
	if [ -n "$mydirs" ]
335
	then
336
		set $mydirs
337
		mydirs=$9
338
	fi
339
340
	gspids=`ps $psopts 2>/dev/null | grep "gnome-session"` > /dev/null 2>&1
341
	# Extract the gnome-session pid
342
	if [ -n "$gspids" ]; then
343
		set $gspids
344
		gspids=$2
345
	fi
346
347
	# Nab the name of the socket
348
	mysock=`/bin/ls -1 /tmp/$mydirs/agent.$gspids`
349
350
	if [ -w $mysock ]; then
351
		if [ -z "$quietopt" ]
352
		then
353
			echo $E " ${GREEN}*${OFF} All previously running ssh-agent(s) have been stopped."
354
			echo $E " ${GREEN}*${OFF} Initializing ${pidf} file..."
355
		fi
356
	
357
		# "> pidf" doesn't work ash.  But it should work with any sh-compatible shell
358
		> "$pidf" || { echo "$0: Cannot create ${pidf}; exiting." 1>&2; rm -f "$pidf" "$cshpidf" "$lockf" 2> /dev/null; exit 1; }
359
		[ -z "$quietopt" ] && echo $E " ${GREEN}*${OFF} Initializing ${cshpidf} file..."
360
		> "$cshpidf" || { echo "$0: Cannot create ${cshpidf}; exiting." 1>&2; rm -f "$pidf" "$cshpidf" "$lockf" 2> /dev/null; exit 1; }
361
		chmod 0600 "$pidf" "$cshpidf"
362
		[ -z "$quietopt" ] && echo $E " ${GREEN}*${OFF} Using existing ssh-agent"
363
		echo "SSH_AUTH_SOCK=$mysock; export SSH_AUTH_SOCK;" > $pidf
364
		echo "SSH_AGENT_PID=$mypids; export SSH_AGENT_PID;" >> $pidf
365
		. "$pidf"
366
		echo "setenv $SSH_AUTH_SOCK_NAME $SSH_AUTH_SOCK;" > "$cshpidf"
367
		echo "setenv $SSH_AGENT_PID_NAME $SSH_AGENT_PID;" >> "$cshpidf"
368
369
		# Bypass the remainder of the "destructive stuff."
370
		match="yes"
371
	fi
372
fi
373
# END - Added 21-Feb-2003 kronenpj@netzero.net
374
328
if [ "$match" = "no" ]
375
if [ "$match" = "no" ]
329
then
376
then
330
	if [ -n "$mypids" ]
377
	if [ -n "$mypids" ]

Return to bug 8553