From 47ffb5d95eb5c5514dae306b7c8e4308f1f001a2 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 27 Oct 2016 20:55:55 +0200 Subject: [PATCH] PR70975 Pass valid offset argument to sendfile PR libstdc++/70975 * src/filesystem/ops.cc (do_copy_file) [_GLIBCXX_USE_SENDFILE]: Pass non-null pointer to sendfile for offset argument. From-SVN: r241629 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/src/filesystem/ops.cc | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 50f58379daa..6a061010eb5 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2016-10-27 Uros Bizjak + + PR libstdc++/70975 + * src/filesystem/ops.cc (do_copy_file) [_GLIBCXX_USE_SENDFILE]: + Pass non-null pointer to sendfile for offset argument. + 2016-10-27 Jonathan Wakely * testsuite/ext/random/uniform_inside_sphere_distribution/cons/ diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc index 9abcee0ea9b..8ed0a105dfa 100644 --- a/libstdc++-v3/src/filesystem/ops.cc +++ b/libstdc++-v3/src/filesystem/ops.cc @@ -444,7 +444,8 @@ namespace } #ifdef _GLIBCXX_USE_SENDFILE - const auto n = ::sendfile(out.fd, in.fd, nullptr, from_st->st_size); + off_t offset = 0; + const auto n = ::sendfile(out.fd, in.fd, &offset, from_st->st_size); if (n < 0 && (errno == ENOSYS || errno == EINVAL)) { #endif -- 2.30.2