diff options
author | Ingela Anderton Andin <[email protected]> | 2012-03-06 09:17:08 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2012-03-06 09:17:08 +0100 |
commit | 98c6caf40154496207329992241c282a039c47f3 (patch) | |
tree | 8247bd06bac24aec0e15c6331b853cc2aac9b484 /lib/ssh/src/ssh_sftpd.erl | |
parent | 16e8d2cb76183d022047c74a20aca014fb38140e (diff) | |
parent | 4ad7238ba71b818fa0e3a1ea24bb002daeb11f3a (diff) | |
download | otp-98c6caf40154496207329992241c282a039c47f3.tar.gz otp-98c6caf40154496207329992241c282a039c47f3.tar.bz2 otp-98c6caf40154496207329992241c282a039c47f3.zip |
Merge branch 'ia/ssh/sftpd-file-handles/OTP-9948' into maint
* ia/ssh/sftpd-file-handles/OTP-9948:
sftp daemon generates file handles correct
Diffstat (limited to 'lib/ssh/src/ssh_sftpd.erl')
-rw-r--r-- | lib/ssh/src/ssh_sftpd.erl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/ssh/src/ssh_sftpd.erl b/lib/ssh/src/ssh_sftpd.erl index 8cc414f83a..ec7b76b0b3 100644 --- a/lib/ssh/src/ssh_sftpd.erl +++ b/lib/ssh/src/ssh_sftpd.erl @@ -424,18 +424,18 @@ handle_op(?SSH_FXP_RENAME, ReqId, State0 end; handle_op(?SSH_FXP_SYMLINK, ReqId, - <<?UINT32(PLen), BPath:PLen/binary, ?UINT32(PLen2), - BPath2:PLen2/binary>>, + <<?UINT32(PLen), Link:PLen/binary, ?UINT32(PLen2), + Target:PLen2/binary>>, State0 = #state{file_handler = FileMod, file_state = FS0}) -> - Path = relate_file_name(BPath, State0), - Path2 = relate_file_name(BPath2, State0), - {Status, FS1} = FileMod:make_symlink(Path2, Path, FS0), + LinkPath = relate_file_name(Link, State0), + TargetPath = relate_file_name(Target, State0), + {Status, FS1} = FileMod:make_symlink(TargetPath, LinkPath, FS0), State1 = State0#state{file_state = FS1}, send_status(Status, ReqId, State1). new_handle([], H) -> H; -new_handle([{N, _} | Rest], H) when N > H -> +new_handle([{N, _,_} | Rest], H) when N =< H -> new_handle(Rest, N+1); new_handle([_ | Rest], H) -> new_handle(Rest, H). @@ -444,6 +444,8 @@ add_handle(State, XF, ReqId, Type, DirFileTuple) -> Handles = State#state.handles, Handle = new_handle(Handles, 0), ssh_xfer:xf_send_handle(XF, ReqId, integer_to_list(Handle)), + %% OBS: If you change handles-tuple also change new_handle! + %% Is this this the best way to implement new handle? State#state{handles = [{Handle, Type, DirFileTuple} | Handles]}. get_handle(Handles, BinHandle) -> |