termux-packages/packages/openssh/mux.c.patch

35 lines
1.1 KiB
Diff

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;