From 56a0697fe079ff3e1ba30a2d5c26b5e45f7b71f8 Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Fri, 13 May 2022 06:31:50 +0000 Subject: upstream: 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@ OpenBSD-Commit-ID: ca39fdd39e0ec1466b9666f15cbcfddea6aaa179 --- sftp-client.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'sftp-client.h') diff --git a/sftp-client.h b/sftp-client.h index 282a4c70..7ca6e8ad 100644 --- a/sftp-client.h +++ b/sftp-client.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp-client.h,v 1.36 2022/03/31 03:07:03 djm Exp $ */ +/* $OpenBSD: sftp-client.h,v 1.37 2022/05/13 06:31:50 djm Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller @@ -141,28 +141,29 @@ int do_fsync(struct sftp_conn *conn, u_char *, u_int); * Download 'remote_path' to 'local_path'. Preserve permissions and times * if 'pflag' is set */ -int do_download(struct sftp_conn *, const char *, const char *, - Attrib *, int, int, int); +int do_download(struct sftp_conn *, const char *, const char *, Attrib *, + int, int, int, int); /* * Recursively download 'remote_directory' to 'local_directory'. Preserve * times if 'pflag' is set */ -int download_dir(struct sftp_conn *, const char *, const char *, - Attrib *, int, int, int, int, int); +int download_dir(struct sftp_conn *, const char *, const char *, Attrib *, + int, int, int, int, int, int); /* * Upload 'local_path' to 'remote_path'. Preserve permissions and times * if 'pflag' is set */ -int do_upload(struct sftp_conn *, const char *, const char *, int, int, int); +int do_upload(struct sftp_conn *, const char *, const char *, + int, int, int, int); /* * Recursively upload 'local_directory' to 'remote_directory'. Preserve * times if 'pflag' is set */ -int upload_dir(struct sftp_conn *, const char *, const char *, int, int, int, - int, int); +int upload_dir(struct sftp_conn *, const char *, const char *, + int, int, int, int, int, int); /* * Download a 'from_path' from the 'from' connection and upload it to -- cgit v1.2.1