summaryrefslogtreecommitdiffstats
path: root/sftp.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2022-05-13 08:31:50 +0200
committerDamien Miller <djm@mindrot.org>2022-05-13 09:00:56 +0200
commit56a0697fe079ff3e1ba30a2d5c26b5e45f7b71f8 (patch)
treedfdc7bf1433d7bd162e70d08b023f429ca8881e7 /sftp.c
parentupstream: Remove errant apostrophe. From haruyama at queen-ml org. (diff)
downloadopenssh-56a0697fe079ff3e1ba30a2d5c26b5e45f7b71f8.tar.xz
openssh-56a0697fe079ff3e1ba30a2d5c26b5e45f7b71f8.zip
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
Diffstat (limited to 'sftp.c')
-rw-r--r--sftp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sftp.c b/sftp.c
index 387132e50..41c7f1c9f 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.215 2022/05/08 22:32:36 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.216 2022/05/13 06:31:50 djm Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -697,12 +697,12 @@ process_get(struct sftp_conn *conn, const char *src, const char *dst,
if (globpath_is_dir(g.gl_pathv[i]) && (rflag || global_rflag)) {
if (download_dir(conn, g.gl_pathv[i], abs_dst, NULL,
pflag || global_pflag, 1, resume,
- fflag || global_fflag, 0) == -1)
+ fflag || global_fflag, 0, 0) == -1)
err = -1;
} else {
if (do_download(conn, g.gl_pathv[i], abs_dst, NULL,
pflag || global_pflag, resume,
- fflag || global_fflag) == -1)
+ fflag || global_fflag, 0) == -1)
err = -1;
}
free(abs_dst);
@@ -791,12 +791,12 @@ process_put(struct sftp_conn *conn, const char *src, const char *dst,
if (globpath_is_dir(g.gl_pathv[i]) && (rflag || global_rflag)) {
if (upload_dir(conn, g.gl_pathv[i], abs_dst,
pflag || global_pflag, 1, resume,
- fflag || global_fflag, 0) == -1)
+ fflag || global_fflag, 0, 0) == -1)
err = -1;
} else {
if (do_upload(conn, g.gl_pathv[i], abs_dst,
pflag || global_pflag, resume,
- fflag || global_fflag) == -1)
+ fflag || global_fflag, 0) == -1)
err = -1;
}
}