forked from premiere/premiere-libtorrent
linux file fixes
This commit is contained in:
parent
5b551c1761
commit
ae1fa3c1b5
12
src/file.cpp
12
src/file.cpp
|
@ -49,6 +49,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/statvfs.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
|
@ -184,6 +185,17 @@ namespace libtorrent
|
||||||
m_fd = ::open(path.external_file_string().c_str()
|
m_fd = ::open(path.external_file_string().c_str()
|
||||||
, mode & (rw_mask | no_buffer), permissions);
|
, mode & (rw_mask | no_buffer), permissions);
|
||||||
|
|
||||||
|
#ifdef TORRENT_LINUX
|
||||||
|
// workaround for linux bug
|
||||||
|
// https://bugs.launchpad.net/ubuntu/+source/linux/+bug/269946
|
||||||
|
if (m_fd == -1 && (mode & no_buffer) && errno == EINVAL)
|
||||||
|
{
|
||||||
|
mode &= ~no_buffer;
|
||||||
|
m_fd = ::open(path.external_file_string().c_str()
|
||||||
|
, mode & (rw_mask | no_buffer), permissions);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
if (m_fd == -1)
|
if (m_fd == -1)
|
||||||
{
|
{
|
||||||
ec = error_code(errno, get_posix_category());
|
ec = error_code(errno, get_posix_category());
|
||||||
|
|
|
@ -1203,7 +1203,7 @@ ret:
|
||||||
ec = error_code(EIO, get_posix_category());
|
ec = error_code(EIO, get_posix_category());
|
||||||
#endif
|
#endif
|
||||||
set_error(m_save_path / file_iter->path, ec);
|
set_error(m_save_path / file_iter->path, ec);
|
||||||
return -1;
|
return bytes_transferred;
|
||||||
}
|
}
|
||||||
advance_bufs(current_buf, bytes_transferred);
|
advance_bufs(current_buf, bytes_transferred);
|
||||||
TORRENT_ASSERT(count_bufs(current_buf, bytes_left - file_bytes_left) <= num_bufs);
|
TORRENT_ASSERT(count_bufs(current_buf, bytes_left - file_bytes_left) <= num_bufs);
|
||||||
|
|
Loading…
Reference in New Issue