diff options
author | 2001-05-19 16:05:41 +0000 | |
---|---|---|
committer | 2001-05-19 16:05:41 +0000 | |
commit | c31ca1e0f30b7a8a277c58de978fa2a791a2ff1f (patch) | |
tree | dd607227b64228d3fe4b39472fd3374b3f0bfe8c /usr.bin/ssh | |
parent | Use an explicit memcpy() to copy a stat struct. Fixes a mysterious (diff) | |
download | wireguard-openbsd-c31ca1e0f30b7a8a277c58de978fa2a791a2ff1f.tar.xz wireguard-openbsd-c31ca1e0f30b7a8a277c58de978fa2a791a2ff1f.zip |
ftruncate() instead of open()+O_TRUNC like rcp.c does
allows scp /path/to/file localhost:/path/to/file
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/scp.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c index 2e744dbe0c3..a62646b56b5 100644 --- a/usr.bin/ssh/scp.c +++ b/usr.bin/ssh/scp.c @@ -75,7 +75,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: scp.c,v 1.70 2001/05/08 19:45:24 mouring Exp $"); +RCSID("$OpenBSD: scp.c,v 1.71 2001/05/19 16:05:41 markus Exp $"); #include "xmalloc.h" #include "atomicio.h" @@ -777,7 +777,7 @@ sink(argc, argv) } omode = mode; mode |= S_IWRITE; - if ((ofd = open(np, O_WRONLY | O_CREAT | O_TRUNC, mode)) < 0) { + if ((ofd = open(np, O_WRONLY|O_CREAT, mode)) < 0) { bad: run_err("%s: %s", np, strerror(errno)); continue; } @@ -832,12 +832,10 @@ bad: run_err("%s: %s", np, strerror(errno)); wrerr = YES; wrerrno = j >= 0 ? EIO : errno; } -#if 0 if (ftruncate(ofd, size)) { run_err("%s: truncate: %s", np, strerror(errno)); wrerr = DISPLAYED; } -#endif if (pflag) { if (exists || omode != mode) if (fchmod(ofd, omode)) |