summaryrefslogtreecommitdiff
path: root/ssh-add.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-add.c')
-rw-r--r--ssh-add.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ssh-add.c b/ssh-add.c
index ac9c808dd..ebfb8a32b 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-add.c,v 1.138 2019/01/21 12:53:35 djm Exp $ */ 1/* $OpenBSD: ssh-add.c,v 1.141 2019/09/06 05:23:55 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -40,8 +40,10 @@
40#include <sys/types.h> 40#include <sys/types.h>
41#include <sys/stat.h> 41#include <sys/stat.h>
42 42
43#include <openssl/evp.h> 43#ifdef WITH_OPENSSL
44#include "openbsd-compat/openssl-compat.h" 44# include <openssl/evp.h>
45# include "openbsd-compat/openssl-compat.h"
46#endif
45 47
46#include <errno.h> 48#include <errno.h>
47#include <fcntl.h> 49#include <fcntl.h>
@@ -203,7 +205,7 @@ add_file(int agent_fd, const char *filename, int key_only, int qflag)
203 if (strcmp(filename, "-") == 0) { 205 if (strcmp(filename, "-") == 0) {
204 fd = STDIN_FILENO; 206 fd = STDIN_FILENO;
205 filename = "(stdin)"; 207 filename = "(stdin)";
206 } else if ((fd = open(filename, O_RDONLY)) < 0) { 208 } else if ((fd = open(filename, O_RDONLY)) == -1) {
207 perror(filename); 209 perror(filename);
208 return -1; 210 return -1;
209 } 211 }
@@ -575,7 +577,6 @@ main(int argc, char **argv)
575 SyslogFacility log_facility = SYSLOG_FACILITY_AUTH; 577 SyslogFacility log_facility = SYSLOG_FACILITY_AUTH;
576 LogLevel log_level = SYSLOG_LEVEL_INFO; 578 LogLevel log_level = SYSLOG_LEVEL_INFO;
577 579
578 ssh_malloc_init(); /* must be called before any mallocs */
579 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ 580 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
580 sanitise_stdfd(); 581 sanitise_stdfd();
581 582
@@ -728,7 +729,7 @@ main(int argc, char **argv)
728 for (i = 0; default_files[i]; i++) { 729 for (i = 0; default_files[i]; i++) {
729 snprintf(buf, sizeof(buf), "%s/%s", pw->pw_dir, 730 snprintf(buf, sizeof(buf), "%s/%s", pw->pw_dir,
730 default_files[i]); 731 default_files[i]);
731 if (stat(buf, &st) < 0) 732 if (stat(buf, &st) == -1)
732 continue; 733 continue;
733 if (do_file(agent_fd, deleting, key_only, buf, 734 if (do_file(agent_fd, deleting, key_only, buf,
734 qflag) == -1) 735 qflag) == -1)