arrange for scp, when in sftp mode, to not ftruncate(3) files early
authordjm <djm@openbsd.org>
Fri, 13 May 2022 06:31:50 +0000 (06:31 +0000)
committerdjm <djm@openbsd.org>
Fri, 13 May 2022 06:31:50 +0000 (06:31 +0000)
commit457a03dabf98ef5768eee5f74033452d89c02f27
tree67b501d48604b21d0973269d97ca9d74a57d2a31
parent9eb589bc5493e44c069fba6ce9702fecf50eda64
arrange for scp, when in sftp mode, to not ftruncate(3) files early

previous behavious of unconditionally truncating the destination file
would cause "scp ~/foo localhost:" and "scp localhost:foo ~/" to
delete all the contents of their destination.

spotted by solene@ sthen@, also bz3431; ok dtucker@
usr.bin/ssh/scp.c
usr.bin/ssh/sftp-client.c
usr.bin/ssh/sftp-client.h
usr.bin/ssh/sftp.c