From f42f7684ecbeec6ce50e0310f80b3d6da2aaf533 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 18 Jul 2014 15:03:27 +1000 Subject: [PATCH] - djm@cvs.openbsd.org 2014/07/17 00:10:18 [mux.c] preserve errno across syscall --- ChangeLog | 3 +++ mux.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7053d72f2..7a3dfb5b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,9 @@ - djm@cvs.openbsd.org 2014/07/17 00:10:56 [sandbox-systrace.c] ifdef SYS_sendsyslog so this will compile without patching on -stable + - djm@cvs.openbsd.org 2014/07/17 00:10:18 + [mux.c] + preserve errno across syscall 20140717 - (djm) [digest-openssl.c] Preserve array order when disabling digests. diff --git a/mux.c b/mux.c index 5278ce4b6..8da2676b3 100644 --- a/mux.c +++ b/mux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mux.c,v 1.46 2014/07/15 15:54:14 millert Exp $ */ +/* $OpenBSD: mux.c,v 1.47 2014/07/17 00:10:18 djm Exp $ */ /* * Copyright (c) 2002-2008 Damien Miller * @@ -1177,6 +1177,7 @@ muxserver_listen(void) char *orig_control_path = options.control_path; char rbuf[16+1]; u_int i, r; + int oerrno; if (options.control_path == NULL || options.control_master == SSHCTL_MASTER_NO) @@ -1203,9 +1204,10 @@ muxserver_listen(void) old_umask = umask(0177); muxserver_sock = unix_listener(options.control_path, 64, 0); + oerrno = errno; umask(old_umask); if (muxserver_sock < 0) { - if (errno == EINVAL || errno == EADDRINUSE) { + if (oerrno == EINVAL || oerrno == EADDRINUSE) { error("ControlSocket %s already exists, " "disabling multiplexing", options.control_path); disable_mux_master: