File 0809-Add-openssh-vendor-extension-to-sftp-rename.patch of Package erlang
From c1e81c244f7cdc97c10205f1ff2373b009545bcb Mon Sep 17 00:00:00 2001
From: Andreas Rydbrink <andreas.rydbrink@gmail.com>
Date: Fri, 11 Oct 2019 21:25:49 +0200
Subject: [PATCH] Add openssh vendor extension to sftp rename.
---
lib/ssh/src/ssh_xfer.erl | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/lib/ssh/src/ssh_xfer.erl b/lib/ssh/src/ssh_xfer.erl
index 1d77ccb311..878c58bc5c 100644
--- a/lib/ssh/src/ssh_xfer.erl
+++ b/lib/ssh/src/ssh_xfer.erl
@@ -156,13 +156,20 @@ rename(XF, ReqID, OldPath, NewPath, Flags) ->
true ->
(<<>>)
end,
- xf_request(XF, ?SSH_FXP_RENAME,
- [?uint32(ReqID),
- ?string_utf8(OldPath),
- ?string_utf8(NewPath),
- FlagBits]).
-
-
+ Ext = XF#ssh_xfer.ext,
+ ExtRename = "posix-rename@openssh.com",
+ case lists:member({ExtRename, "1"}, Ext) of
+ true ->
+ extended(XF, ReqID, ExtRename,
+ [?string_utf8(OldPath),
+ ?string_utf8(NewPath)]);
+ false ->
+ xf_request(XF, ?SSH_FXP_RENAME,
+ [?uint32(ReqID),
+ ?string_utf8(OldPath),
+ ?string_utf8(NewPath),
+ FlagBits])
+ end.
%% Create directory
mkdir(XF, ReqID, Path, Attrs) ->
@@ -261,7 +268,7 @@ extended(XF, ReqID, Request, Data) ->
xf_request(XF, ?SSH_FXP_EXTENDED,
[?uint32(ReqID),
?string(Request),
- ?binary(Data)]).
+ Data]).
%% Send xfer request to connection manager
--
2.16.4