diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2002-03-22 03:21:16 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2002-03-22 03:21:16 +0000 |
commit | 58b391b1bdaaea1dc7d8e65e1d3549d16bc323f4 (patch) | |
tree | b4251b009aa080362ecbc2ad696e4f928aab629c /ssh-add.c | |
parent | 1ee9ec32a36e6692dd619e784248768bdd5f853e (diff) |
- markus@cvs.openbsd.org 2002/03/21 10:21:20
[ssh-add.c]
ignore errors for nonexisting default keys in ssh-add,
fixes http://bugzilla.mindrot.org/show_bug.cgi?id=158
Last patch was SUPPOSE to be:
- stevesk@cvs.openbsd.org 2002/03/20 21:08:08
[sshd.c]
strerror() on chdir() fail; ok provos@
But it got co-mingled. <sigh> Flog me at will.
Diffstat (limited to 'ssh-add.c')
-rw-r--r-- | ssh-add.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -35,7 +35,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh-add.c,v 1.51 2002/03/19 10:49:35 markus Exp $"); +RCSID("$OpenBSD: ssh-add.c,v 1.52 2002/03/21 10:21:20 markus Exp $"); #include <openssl/evp.h> @@ -310,6 +310,8 @@ main(int argc, char **argv) if (argc == 0) { char buf[MAXPATHLEN]; struct passwd *pw; + struct stat st; + int count = 0; if ((pw = getpwuid(getuid())) == NULL) { fprintf(stderr, "No user found with uid %u\n", @@ -321,9 +323,15 @@ main(int argc, char **argv) for(i = 0; default_files[i]; i++) { snprintf(buf, sizeof(buf), "%s/%s", pw->pw_dir, default_files[i]); + if (stat(buf, &st) < 0) + continue; if (do_file(ac, deleting, buf) == -1) ret = 1; + else + count++; } + if (count == 0) + ret = 1; } else { for(i = 0; i < argc; i++) { if (do_file(ac, deleting, argv[i]) == -1) |