| 1 | diff -u -r ../openssh-7.2p2/sftp-server.c ./sftp-server.c |
| 2 | --- ../openssh-7.2p2/sftp-server.c 2016-03-09 13:04:48.000000000 -0500 |
| 3 | +++ ./sftp-server.c 2016-06-06 18:13:28.141236751 -0400 |
| 4 | @@ -1190,7 +1190,9 @@ |
| 5 | if (lstat(oldpath, &sb) == -1) |
| 6 | status = errno_to_portable(errno); |
| 7 | else if (S_ISREG(sb.st_mode)) { |
| 8 | +#ifndef __ANDROID__ |
| 9 | /* Race-free rename of regular files */ |
| 10 | + /* Do not try this for Android which does not support links */ |
| 11 | if (link(oldpath, newpath) == -1) { |
| 12 | if (errno == EOPNOTSUPP || errno == ENOSYS |
| 13 | #ifdef EXDEV |
| 14 | @@ -1200,6 +1202,7 @@ |
| 15 | || errno == LINK_OPNOTSUPP_ERRNO |
| 16 | #endif |
| 17 | ) { |
| 18 | +#endif |
| 19 | struct stat st; |
| 20 | |
| 21 | /* |
| 22 | @@ -1213,6 +1216,7 @@ |
| 23 | else |
| 24 | status = SSH2_FX_OK; |
| 25 | } |
| 26 | +#ifndef __ANDROID__ |
| 27 | } else { |
| 28 | status = errno_to_portable(errno); |
| 29 | } |
| 30 | @@ -1222,6 +1226,7 @@ |
| 31 | unlink(newpath); |
| 32 | } else |
| 33 | status = SSH2_FX_OK; |
| 34 | +#endif |
| 35 | } else if (stat(newpath, &sb) == -1) { |
| 36 | if (rename(oldpath, newpath) == -1) |
| 37 | status = errno_to_portable(errno); |