summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog7
-rw-r--r--scp.c13
2 files changed, 5 insertions, 15 deletions
diff --git a/debian/changelog b/debian/changelog
index a1d8057d8..88aa405d3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,3 @@
1openssh (1:4.6p1-7) UNRELEASED; urgency=low
2
3 * Make scp only ftruncate if it hasn't written the required number of
4 bytes (works around #447153).
5
6 -- Colin Watson <cjwatson@ubuntu.com> Mon, 12 Nov 2007 19:09:29 +0000
7
8openssh (1:4.6p1-6) unstable; urgency=low 1openssh (1:4.6p1-6) unstable; urgency=low
9 2
10 * Remove blank line between head comment and first template in 3 * Remove blank line between head comment and first template in
diff --git a/scp.c b/scp.c
index d984611a7..a52aaeb12 100644
--- a/scp.c
+++ b/scp.c
@@ -808,7 +808,7 @@ sink(int argc, char **argv)
808 size_t j, count; 808 size_t j, count;
809 int amt, exists, first, ofd; 809 int amt, exists, first, ofd;
810 mode_t mode, omode, mask; 810 mode_t mode, omode, mask;
811 off_t size, statbytes, writtenbytes; 811 off_t size, statbytes;
812 int setimes, targisdir, wrerrno = 0; 812 int setimes, targisdir, wrerrno = 0;
813 char ch, *cp, *np, *targ, *why, *vect[1], buf[2048]; 813 char ch, *cp, *np, *targ, *why, *vect[1], buf[2048];
814 struct timeval tv[2]; 814 struct timeval tv[2];
@@ -978,7 +978,7 @@ bad: run_err("%s: %s", np, strerror(errno));
978 cp = bp->buf; 978 cp = bp->buf;
979 wrerr = NO; 979 wrerr = NO;
980 980
981 statbytes = writtenbytes = 0; 981 statbytes = 0;
982 if (showprogress) 982 if (showprogress)
983 start_progress_meter(curfile, size, &statbytes); 983 start_progress_meter(curfile, size, &statbytes);
984 for (count = i = 0; i < size; i += 4096) { 984 for (count = i = 0; i < size; i += 4096) {
@@ -1008,8 +1008,7 @@ bad: run_err("%s: %s", np, strerror(errno));
1008 count) != count) { 1008 count) != count) {
1009 wrerr = YES; 1009 wrerr = YES;
1010 wrerrno = errno; 1010 wrerrno = errno;
1011 } else 1011 }
1012 writtenbytes += (off_t)count;
1013 } 1012 }
1014 count = 0; 1013 count = 0;
1015 cp = bp->buf; 1014 cp = bp->buf;
@@ -1021,10 +1020,8 @@ bad: run_err("%s: %s", np, strerror(errno));
1021 atomicio(vwrite, ofd, bp->buf, count) != count) { 1020 atomicio(vwrite, ofd, bp->buf, count) != count) {
1022 wrerr = YES; 1021 wrerr = YES;
1023 wrerrno = errno; 1022 wrerrno = errno;
1024 } else 1023 }
1025 writtenbytes += (off_t)count; 1024 if (wrerr == NO && ftruncate(ofd, size) != 0) {
1026 if (wrerr == NO && writtenbytes < size &&
1027 ftruncate(ofd, size) != 0) {
1028 run_err("%s: truncate: %s", np, strerror(errno)); 1025 run_err("%s: truncate: %s", np, strerror(errno));
1029 wrerr = DISPLAYED; 1026 wrerr = DISPLAYED;
1030 } 1027 }