diff options
author | Mattias Andrée <maandree@kth.se> | 2021-09-04 11:46:52 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-09-04 11:46:52 +0200 |
commit | 621ad9b18956a81df2b676305547c6321179dc7c (patch) | |
tree | c9d46e5b92a1d39fc9b72732dcd9d5866290eda4 | |
parent | Add missing newline to end of error prints (diff) | |
download | editasroot-1.0.1.tar.gz editasroot-1.0.1.tar.bz2 editasroot-1.0.1.tar.xz |
Fix errors in copy_file1.0.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | common.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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); } |