| 1 | diff -u -r ../openssh-7.1p1/mux.c ./mux.c |
| 2 | --- ../openssh-7.1p1/mux.c 2015-08-21 00:49:03.000000000 -0400 |
| 3 | +++ ./mux.c 2015-12-17 19:20:36.368902909 -0500 |
| 4 | @@ -1295,6 +1295,22 @@ |
| 5 | } |
| 6 | |
| 7 | /* Now atomically "move" the mux socket into position */ |
| 8 | +#ifdef __ANDROID__ |
| 9 | + /* Android does not support hard links, so use a non-atomic |
| 10 | + check-then-rename for now. */ |
| 11 | + if (access(orig_control_path, F_OK) == 0) { |
| 12 | + error("ControlSocket %s already exists, disabling multiplexing", |
| 13 | + orig_control_path); |
| 14 | + unlink(options.control_path); |
| 15 | + goto disable_mux_master; |
| 16 | + } else { |
| 17 | + if (rename(options.control_path, orig_control_path) == -1) { |
| 18 | + fatal("%s: link mux listener %s => %s: %s", __func__, |
| 19 | + options.control_path, orig_control_path, |
| 20 | + strerror(errno)); |
| 21 | + } |
| 22 | + } |
| 23 | +#else |
| 24 | if (link(options.control_path, orig_control_path) != 0) { |
| 25 | if (errno != EEXIST) { |
| 26 | fatal("%s: link mux listener %s => %s: %s", __func__, |
| 27 | @@ -1307,6 +1324,7 @@ |
| 28 | goto disable_mux_master; |
| 29 | } |
| 30 | unlink(options.control_path); |
| 31 | +#endif |
| 32 | free(options.control_path); |
| 33 | options.control_path = orig_control_path; |
| 34 | |