From 7bad55b8cbcb0bade494eb30dbd15c67c8cd9f22 Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Tue, 5 Jun 2001 19:31:41 +0000 Subject: - markus@cvs.openbsd.org 2001/05/19 16:05:41 [scp.c] ftruncate() instead of open()+O_TRUNC like rcp.c does allows scp /path/to/file localhost:/path/to/file --- ChangeLog | 6 +++++- scp.c | 6 ++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc76b405d..7d7799318 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,10 @@ [session.c] Disable X11 forwarding if xauth binary is not found. Patch from Nalin Dahyabhai ; ok markus@ + - markus@cvs.openbsd.org 2001/05/19 16:05:41 + [scp.c] + ftruncate() instead of open()+O_TRUNC like rcp.c does + allows scp /path/to/file localhost:/path/to/file 20010528 - (tim) [conifgure.in] add setvbuf test needed for sftp-int.c @@ -5442,4 +5446,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1229 2001/06/05 19:29:20 mouring Exp $ +$Id: ChangeLog,v 1.1230 2001/06/05 19:31:41 mouring Exp $ diff --git a/scp.c b/scp.c index 52fd513c6..89f05ad96 100644 --- a/scp.c +++ b/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" @@ -804,7 +804,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; } @@ -859,12 +859,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) #ifdef HAVE_FCHMOD -- cgit v1.2.3