summaryrefslogtreecommitdiff
path: root/ssh-add.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-add.c')
-rw-r--r--ssh-add.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ssh-add.c b/ssh-add.c
index 8ef9702f6..baf2b3de7 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: ssh-add.c,v 1.51 2002/03/19 10:49:35 markus Exp $"); 38RCSID("$OpenBSD: ssh-add.c,v 1.52 2002/03/21 10:21:20 markus Exp $");
39 39
40#include <openssl/evp.h> 40#include <openssl/evp.h>
41 41
@@ -310,6 +310,8 @@ main(int argc, char **argv)
310 if (argc == 0) { 310 if (argc == 0) {
311 char buf[MAXPATHLEN]; 311 char buf[MAXPATHLEN];
312 struct passwd *pw; 312 struct passwd *pw;
313 struct stat st;
314 int count = 0;
313 315
314 if ((pw = getpwuid(getuid())) == NULL) { 316 if ((pw = getpwuid(getuid())) == NULL) {
315 fprintf(stderr, "No user found with uid %u\n", 317 fprintf(stderr, "No user found with uid %u\n",
@@ -321,9 +323,15 @@ main(int argc, char **argv)
321 for(i = 0; default_files[i]; i++) { 323 for(i = 0; default_files[i]; i++) {
322 snprintf(buf, sizeof(buf), "%s/%s", pw->pw_dir, 324 snprintf(buf, sizeof(buf), "%s/%s", pw->pw_dir,
323 default_files[i]); 325 default_files[i]);
326 if (stat(buf, &st) < 0)
327 continue;
324 if (do_file(ac, deleting, buf) == -1) 328 if (do_file(ac, deleting, buf) == -1)
325 ret = 1; 329 ret = 1;
330 else
331 count++;
326 } 332 }
333 if (count == 0)
334 ret = 1;
327 } else { 335 } else {
328 for(i = 0; i < argc; i++) { 336 for(i = 0; i < argc; i++) {
329 if (do_file(ac, deleting, argv[i]) == -1) 337 if (do_file(ac, deleting, argv[i]) == -1)