0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-05-10 16:15:44 +00:00
Files
termux-packages/packages/openssh/sftp-server.c.patch
2023-11-23 16:32:34 +02:00

38 lines
1.1 KiB
Diff

diff -uNr openssh-portable-V_9_5_P1/sftp-server.c openssh-portable-V_9_5_P1.mod/sftp-server.c
--- openssh-portable-V_9_5_P1/sftp-server.c 2023-10-04 07:34:10.000000000 +0300
+++ openssh-portable-V_9_5_P1.mod/sftp-server.c 2023-11-23 16:29:34.271209449 +0200
@@ -1281,7 +1281,9 @@
if (lstat(oldpath, &sb) == -1)
status = errno_to_portable(errno);
else if (S_ISREG(sb.st_mode)) {
+#ifndef __ANDROID__
/* Race-free rename of regular files */
+ /* Do not try this for Android which does not support links */
if (link(oldpath, newpath) == -1) {
if (errno == EOPNOTSUPP || errno == ENOSYS
#ifdef EXDEV
@@ -1291,6 +1293,7 @@
|| errno == LINK_OPNOTSUPP_ERRNO
#endif
) {
+#endif
struct stat st;
/*
@@ -1304,6 +1307,7 @@
else
status = SSH2_FX_OK;
}
+#ifndef __ANDROID__
} else {
status = errno_to_portable(errno);
}
@@ -1313,6 +1317,7 @@
unlink(newpath);
} else
status = SSH2_FX_OK;
+#endif
} else if (stat(newpath, &sb) == -1) {
if (rename(oldpath, newpath) == -1)
status = errno_to_portable(errno);