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
This commit is contained in:
Uros Bizjak 2016-10-27 20:55:55 +02:00 committed by Uros Bizjak
parent 4ce7157987
commit 47ffb5d95e
2 changed files with 8 additions and 1 deletions

View File

@ -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/

View File

@ -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