Browse Source
The ControlMaster feature for multiplexing used hard links, which does not work on Android starting in Android 6.0. Replace this with a non-atomic check-then-rename for now. Fixes #91.android-5
Fredrik Fornwall
9 years ago
2 changed files with 35 additions and 1 deletions
@ -0,0 +1,34 @@ |
|||||
|
diff -u -r ../openssh-7.1p1/mux.c ./mux.c
|
||||
|
--- ../openssh-7.1p1/mux.c 2015-08-21 00:49:03.000000000 -0400
|
||||
|
+++ ./mux.c 2015-12-17 19:20:36.368902909 -0500
|
||||
|
@@ -1295,6 +1295,22 @@
|
||||
|
} |
||||
|
|
||||
|
/* Now atomically "move" the mux socket into position */ |
||||
|
+#ifdef __ANDROID__
|
||||
|
+ /* Android does not support hard links, so use a non-atomic
|
||||
|
+ check-then-rename for now. */
|
||||
|
+ if (access(orig_control_path, F_OK) == 0) {
|
||||
|
+ error("ControlSocket %s already exists, disabling multiplexing",
|
||||
|
+ orig_control_path);
|
||||
|
+ unlink(options.control_path);
|
||||
|
+ goto disable_mux_master;
|
||||
|
+ } else {
|
||||
|
+ if (rename(options.control_path, orig_control_path) == -1) {
|
||||
|
+ fatal("%s: link mux listener %s => %s: %s", __func__,
|
||||
|
+ options.control_path, orig_control_path,
|
||||
|
+ strerror(errno));
|
||||
|
+ }
|
||||
|
+ }
|
||||
|
+#else
|
||||
|
if (link(options.control_path, orig_control_path) != 0) { |
||||
|
if (errno != EEXIST) { |
||||
|
fatal("%s: link mux listener %s => %s: %s", __func__, |
||||
|
@@ -1307,6 +1324,7 @@
|
||||
|
goto disable_mux_master; |
||||
|
} |
||||
|
unlink(options.control_path); |
||||
|
+#endif
|
||||
|
free(options.control_path); |
||||
|
options.control_path = orig_control_path; |
||||
|
|
Loading…
Reference in new issue