aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--common.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/common.c b/common.c
index 5add5a1..e1d4e03 100644
--- a/common.c
+++ b/common.c
@@ -35,8 +35,8 @@ copy_file(int destfd, const char *destfname, int srcfd, const char *srcfname, in
r += (ssize_t)read_off;
for (p = ok_off; p < r; p += w) {
- w = write(destfd, buf, (size_t)(r - p));
- if (r <= 0) {
+ w = write(destfd, &buf[p], (size_t)(r - p));
+ if (w <= 0) {
fprintf(stderr, "%s: write %s: %s\n", argv0, destfname, strerror(errno));
exit(1);
}
@@ -45,7 +45,7 @@ copy_file(int destfd, const char *destfname, int srcfd, const char *srcfname, in
if (!okp) {
w = write(destfd, buf, 1);
- if (r <= 0) {
+ if (w <= 0) {
fprintf(stderr, "%s: write %s: %s\n", argv0, destfname, strerror(errno));
exit(1);
}