diff options
author | djm@openbsd.org <djm@openbsd.org> | 2022-05-13 08:31:50 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2022-05-13 09:00:56 +0200 |
commit | 56a0697fe079ff3e1ba30a2d5c26b5e45f7b71f8 (patch) | |
tree | dfdc7bf1433d7bd162e70d08b023f429ca8881e7 /sftp.c | |
parent | upstream: Remove errant apostrophe. From haruyama at queen-ml org. (diff) | |
download | openssh-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.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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; } } |