diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-09-29 19:58:50 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-10-01 08:29:16 +0200 |
commit | e986910e87ef3e850423a7c1817b78c2d3275c38 (patch) | |
tree | 01145eec7a29062949da536eebf57848476ebdfa /src/import/pull-job.c | |
parent | trivial: fix spelling in code comments (diff) | |
download | systemd-e986910e87ef3e850423a7c1817b78c2d3275c38.tar.xz systemd-e986910e87ef3e850423a7c1817b78c2d3275c38.zip |
import: sparse_write() returns negative errno
Diffstat (limited to 'src/import/pull-job.c')
-rw-r--r-- | src/import/pull-job.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/import/pull-job.c b/src/import/pull-job.c index 1f78f09718..c494bbec3c 100644 --- a/src/import/pull-job.c +++ b/src/import/pull-job.c @@ -233,10 +233,13 @@ static int pull_job_write_uncompressed(const void *p, size_t sz, void *userdata) if (j->allow_sparse) n = sparse_write(j->disk_fd, p, sz, 64); - else + else { n = write(j->disk_fd, p, sz); + if (n < 0) + n = -errno; + } if (n < 0) - return log_error_errno(errno, "Failed to write file: %m"); + return log_error_errno((int) n, "Failed to write file: %m"); if ((size_t) n < sz) { log_error("Short write"); return -EIO; |