diff options
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/ssh-add.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/ssh/ssh-add.c b/usr.bin/ssh/ssh-add.c index 28728f35ef4..c7079f7fb82 100644 --- a/usr.bin/ssh/ssh-add.c +++ b/usr.bin/ssh/ssh-add.c @@ -35,7 +35,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh-add.c,v 1.49 2001/12/24 07:29:43 deraadt Exp $"); +RCSID("$OpenBSD: ssh-add.c,v 1.50 2002/01/29 14:27:57 markus Exp $"); #include <openssl/evp.h> @@ -181,7 +181,7 @@ update_card(AuthenticationConnection *ac, int add, const char *id) } } -static void +static int list_identities(AuthenticationConnection *ac, int do_fp) { Key *key; @@ -209,8 +209,11 @@ list_identities(AuthenticationConnection *ac, int do_fp) xfree(comment); } } - if (!had_identities) + if (!had_identities) { printf("The agent has no identities.\n"); + return -1; + } + return 0; } static int @@ -256,13 +259,14 @@ main(int argc, char **argv) ac = ssh_get_authentication_connection(); if (ac == NULL) { fprintf(stderr, "Could not open a connection to your authentication agent.\n"); - exit(1); + exit(2); } while ((ch = getopt(argc, argv, "lLdDe:s:")) != -1) { switch (ch) { case 'l': case 'L': - list_identities(ac, ch == 'l' ? 1 : 0); + if (list_identities(ac, ch == 'l' ? 1 : 0) == -1) + ret = 1; goto done; break; case 'd': |