summaryrefslogtreecommitdiff
path: root/mux.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2014-07-18 15:03:27 +1000
committerDamien Miller <djm@mindrot.org>2014-07-18 15:03:27 +1000
commitf42f7684ecbeec6ce50e0310f80b3d6da2aaf533 (patch)
tree5a97b22b063cbd33b7d8c2991bdc3a5f76eeee72 /mux.c
parent1b83320628cb0733e3688b85bfe4d388a7c51909 (diff)
- djm@cvs.openbsd.org 2014/07/17 00:10:18
[mux.c] preserve errno across syscall
Diffstat (limited to 'mux.c')
-rw-r--r--mux.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mux.c b/mux.c
index 5278ce4b6..8da2676b3 100644
--- a/mux.c
+++ b/mux.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mux.c,v 1.46 2014/07/15 15:54:14 millert Exp $ */ 1/* $OpenBSD: mux.c,v 1.47 2014/07/17 00:10:18 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -1177,6 +1177,7 @@ muxserver_listen(void)
1177 char *orig_control_path = options.control_path; 1177 char *orig_control_path = options.control_path;
1178 char rbuf[16+1]; 1178 char rbuf[16+1];
1179 u_int i, r; 1179 u_int i, r;
1180 int oerrno;
1180 1181
1181 if (options.control_path == NULL || 1182 if (options.control_path == NULL ||
1182 options.control_master == SSHCTL_MASTER_NO) 1183 options.control_master == SSHCTL_MASTER_NO)
@@ -1203,9 +1204,10 @@ muxserver_listen(void)
1203 1204
1204 old_umask = umask(0177); 1205 old_umask = umask(0177);
1205 muxserver_sock = unix_listener(options.control_path, 64, 0); 1206 muxserver_sock = unix_listener(options.control_path, 64, 0);
1207 oerrno = errno;
1206 umask(old_umask); 1208 umask(old_umask);
1207 if (muxserver_sock < 0) { 1209 if (muxserver_sock < 0) {
1208 if (errno == EINVAL || errno == EADDRINUSE) { 1210 if (oerrno == EINVAL || oerrno == EADDRINUSE) {
1209 error("ControlSocket %s already exists, " 1211 error("ControlSocket %s already exists, "
1210 "disabling multiplexing", options.control_path); 1212 "disabling multiplexing", options.control_path);
1211 disable_mux_master: 1213 disable_mux_master: