|  | @@ -52,6 +52,7 @@ then
 | 
		
	
		
			
			| 52 | 52 |      configfile="${rootdir}/config"
 | 
		
	
		
			
			| 53 | 53 |      sshdir="${rootdir}/ssh"
 | 
		
	
		
			
			| 54 | 54 |      oldenvfile="${rootdir}/previous-environment"
 | 
		
	
		
			
			|  | 55 | +    sshagentsocket="${sshdir}/.ssh-agent-$$"
 | 
		
	
		
			
			| 55 | 56 |      
 | 
		
	
		
			
			| 56 | 57 |      if [ "$_GITNONYMOUS" != "" ]
 | 
		
	
		
			
			| 57 | 58 |      # toggle everything off again
 | 
		
	
	
		
			
			|  | @@ -79,8 +80,15 @@ then
 | 
		
	
		
			
			| 79 | 80 |        # add our custom local SSH key (make the key with ./make-anonymous-key)
 | 
		
	
		
			
			| 80 | 81 |        if [ -f ${sshdir}/id_rsa ]
 | 
		
	
		
			
			| 81 | 82 |        then
 | 
		
	
		
			
			|  | 83 | +        # if a stale socket already exists then throw an error
 | 
		
	
		
			
			|  | 84 | +        if [ -f "${sshagentsocket}" ]
 | 
		
	
		
			
			|  | 85 | +        then
 | 
		
	
		
			
			|  | 86 | +          gitnonymous_error "Stale SSH agent socket '${sshagentsocket}' exists."
 | 
		
	
		
			
			|  | 87 | +          gitnonymous_error "You can probably delete it safely and try again."
 | 
		
	
		
			
			|  | 88 | +          return 2
 | 
		
	
		
			
			|  | 89 | +        fi
 | 
		
	
		
			
			| 82 | 90 |          # start a new SSH agent just for this session
 | 
		
	
		
			
			| 83 |  | -        eval $(ssh-agent -a "${sshdir}/.ssh-agent")
 | 
		
	
		
			
			|  | 91 | +        eval $(ssh-agent -a "${sshagentsocket}")
 | 
		
	
		
			
			| 84 | 92 |          # add the key
 | 
		
	
		
			
			| 85 | 93 |          ssh-add ${sshdir}/id_rsa
 | 
		
	
		
			
			| 86 | 94 |        else
 |