- (djm) [contrib/ssh-copy-id] Don't blow up when the agent has no keys;
   bz#1723 patch from Adeodato Simó via Colin Watson; ok dtucker@
diff --git a/ChangeLog b/ChangeLog
index 0243ef4..cc6cd5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,8 @@
    ok dtucker@
  - (dtucker) Bug #1725: explicitly link libX11 into gnome-ssh-askpass2 using
    pkg-config, patch from Colin Watson.  Needed for newer linkers (ie gold).
+ - (djm) [contrib/ssh-copy-id] Don't blow up when the agent has no keys;
+   bz#1723 patch from Adeodato Simóvia Colin Watson; ok dtucker@
 
 20100324
  - (dtucker) [contrib/cygwin/ssh-host-config] Mount the Windows directory
diff --git a/contrib/ssh-copy-id b/contrib/ssh-copy-id
index df74d25..65c0a8c 100644
--- a/contrib/ssh-copy-id
+++ b/contrib/ssh-copy-id
@@ -19,7 +19,7 @@
     shift         # and this should leave $1 as the target name
   fi
 else
-  if [ x$SSH_AUTH_SOCK != x ] ; then
+  if [ x$SSH_AUTH_SOCK != x ] && ssh-add -L >/dev/null 2>&1; then
     GET_ID="$GET_ID ssh-add -L"
   fi
 fi