[PATCH] rename mux socket instead of link/unlink

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



From: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>

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@localhost:22

Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
---
 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

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev



[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux