summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/ssh.c b/ssh.c
index add697ae0..2bdc7ab91 100644
--- a/ssh.c
+++ b/ssh.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: ssh.c,v 1.236 2005/04/21 11:47:19 djm Exp $"); 43RCSID("$OpenBSD: ssh.c,v 1.237 2005/04/26 13:08:37 jakob Exp $");
44 44
45#include <openssl/evp.h> 45#include <openssl/evp.h>
46#include <openssl/err.h> 46#include <openssl/err.h>
@@ -613,7 +613,7 @@ again:
613 options.control_path, original_real_uid); 613 options.control_path, original_real_uid);
614 } 614 }
615 if (options.control_path != NULL && options.control_master == 0) 615 if (options.control_path != NULL && options.control_master == 0)
616 control_client(options.control_path); /* This doesn't return */ 616 control_client(options.control_path);
617 617
618 /* Open a connection to the remote host. */ 618 /* Open a connection to the remote host. */
619 if (ssh_connect(host, &hostaddr, options.port, 619 if (ssh_connect(host, &hostaddr, options.port,
@@ -1290,15 +1290,6 @@ control_client(const char *path)
1290 extern char **environ; 1290 extern char **environ;
1291 u_int flags; 1291 u_int flags;
1292 1292
1293 if (stdin_null_flag) {
1294 if ((fd = open(_PATH_DEVNULL, O_RDONLY)) == -1)
1295 fatal("open(/dev/null): %s", strerror(errno));
1296 if (dup2(fd, STDIN_FILENO) == -1)
1297 fatal("dup2: %s", strerror(errno));
1298 if (fd > STDERR_FILENO)
1299 close(fd);
1300 }
1301
1302 memset(&addr, '\0', sizeof(addr)); 1293 memset(&addr, '\0', sizeof(addr));
1303 addr.sun_family = AF_UNIX; 1294 addr.sun_family = AF_UNIX;
1304 addr_len = offsetof(struct sockaddr_un, sun_path) + 1295 addr_len = offsetof(struct sockaddr_un, sun_path) +
@@ -1311,8 +1302,20 @@ control_client(const char *path)
1311 if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) 1302 if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)
1312 fatal("%s socket(): %s", __func__, strerror(errno)); 1303 fatal("%s socket(): %s", __func__, strerror(errno));
1313 1304
1314 if (connect(sock, (struct sockaddr*)&addr, addr_len) == -1) 1305 if (connect(sock, (struct sockaddr*)&addr, addr_len) == -1) {
1315 fatal("Couldn't connect to %s: %s", path, strerror(errno)); 1306 debug("Couldn't connect to %s: %s", path, strerror(errno));
1307 close(sock);
1308 return;
1309 }
1310
1311 if (stdin_null_flag) {
1312 if ((fd = open(_PATH_DEVNULL, O_RDONLY)) == -1)
1313 fatal("open(/dev/null): %s", strerror(errno));
1314 if (dup2(fd, STDIN_FILENO) == -1)
1315 fatal("dup2: %s", strerror(errno));
1316 if (fd > STDERR_FILENO)
1317 close(fd);
1318 }
1316 1319
1317 if ((term = getenv("TERM")) == NULL) 1320 if ((term = getenv("TERM")) == NULL)
1318 term = ""; 1321 term = "";