summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2016-10-27 18:55:55 +0000
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2016-10-27 18:55:55 +0000
commit1e312c9c2e8435a76f60a3837eb5cd8180ecda5c (patch)
tree4ea39a1246fa9188aec95ff3d20641e31b04f656
parentb95a2fd4a74c9ec1f9913e958b5291b30d53f60f (diff)
downloadgcc-1e312c9c2e8435a76f60a3837eb5cd8180ecda5c.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241629 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/src/filesystem/ops.cc3
2 files changed, 8 insertions, 1 deletions
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 <ubizjak@gmail.com>
+
+ 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 <jwakely@redhat.com>
* 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