openssh: Do not try link(2) for sftp-server rename
Hard links are not supported on Android from 6.0 on. Fixes #293.
This commit is contained in:
parent
d308429ede
commit
98c7df17fe
@ -1,7 +1,7 @@
|
||||
TERMUX_PKG_HOMEPAGE=http://www.openssh.com/
|
||||
TERMUX_PKG_DESCRIPTION="Secure shell for logging into a remote machine"
|
||||
TERMUX_PKG_VERSION=7.2p2
|
||||
TERMUX_PKG_BUILD_REVISION=2
|
||||
TERMUX_PKG_BUILD_REVISION=3
|
||||
TERMUX_PKG_SRCURL=http://ftp.eu.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${TERMUX_PKG_VERSION}.tar.gz
|
||||
TERMUX_PKG_DEPENDS="libandroid-support, ldns, openssl"
|
||||
# --disable-strip to prevent host "install" command to use "-s", which won't work for target binaries:
|
||||
|
37
packages/openssh/sftp-server.c.patch
Normal file
37
packages/openssh/sftp-server.c.patch
Normal file
@ -0,0 +1,37 @@
|
||||
diff -u -r ../openssh-7.2p2/sftp-server.c ./sftp-server.c
|
||||
--- ../openssh-7.2p2/sftp-server.c 2016-03-09 13:04:48.000000000 -0500
|
||||
+++ ./sftp-server.c 2016-06-06 18:13:28.141236751 -0400
|
||||
@@ -1190,7 +1190,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
|
||||
@@ -1200,6 +1202,7 @@
|
||||
|| errno == LINK_OPNOTSUPP_ERRNO
|
||||
#endif
|
||||
) {
|
||||
+#endif
|
||||
struct stat st;
|
||||
|
||||
/*
|
||||
@@ -1213,6 +1216,7 @@
|
||||
else
|
||||
status = SSH2_FX_OK;
|
||||
}
|
||||
+#ifndef __ANDROID__
|
||||
} else {
|
||||
status = errno_to_portable(errno);
|
||||
}
|
||||
@@ -1222,6 +1226,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);
|
Loading…
Reference in New Issue
Block a user