[PATCH] rename mux socket instead of link/unlink
Ruediger Meier
sweet_f_a at gmx.de
Thu Jul 2 04:52:47 AEST 2015
From: Ruediger Meier <ruediger.meier at ga-group.nl>
This avoids confusing .nfs* files if ControlPath located on NFS.
Seen on Linux like below. The .nfs* file exists there until the
master connection is killed.
$ ssh -Nf localhost
$ ls -lta .ssh/masters/
srw------- 2 rudi users 0 2015-07-01 20:45:53.183434875 +0200 .nfs000000000114029600005581
srw------- 2 rudi users 0 2015-07-01 20:45:53.183434875 +0200 zapparudi at localhost:22
Signed-off-by: Ruediger Meier <ruediger.meier at ga-group.nl>
---
mux.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mux.c b/mux.c
index cdc01bd..03b686d 100644
--- a/mux.c
+++ b/mux.c
@@ -1291,7 +1291,7 @@ muxserver_listen(void)
}
/* Now atomically "move" the mux socket into position */
- if (link(options.control_path, orig_control_path) != 0) {
+ if (rename(options.control_path, orig_control_path) != 0) {
if (errno != EEXIST) {
fatal("%s: link mux listener %s => %s: %s", __func__,
options.control_path, orig_control_path,
@@ -1302,7 +1302,6 @@ muxserver_listen(void)
unlink(options.control_path);
goto disable_mux_master;
}
- unlink(options.control_path);
free(options.control_path);
options.control_path = orig_control_path;
--
1.8.4.5
More information about the openssh-unix-dev
mailing list