merged linux permission issue fix from RC_0_16
This commit is contained in:
parent
3d7dc768da
commit
a62a2a5b6c
|
@ -1,6 +1,7 @@
|
|||
* fix uTP edge case where udp socket buffer fills up
|
||||
* fix nagle implementation in uTP
|
||||
|
||||
* fix permissions issue on linux whith noatime enabled for non-owned files
|
||||
* use random peer IDs in anonymous mode
|
||||
* fix move_storage bugs
|
||||
* fix unnecessary dependency on boost.date_time when building boost.asio as separate compilation
|
||||
|
|
22
src/file.cpp
22
src/file.cpp
|
@ -980,9 +980,27 @@ namespace libtorrent
|
|||
{
|
||||
mode &= ~no_buffer;
|
||||
m_fd = ::open(path.c_str()
|
||||
, mode & (rw_mask | no_buffer), permissions);
|
||||
}
|
||||
, mode_array[mode & rw_mask]
|
||||
#ifdef O_NOATIME
|
||||
| no_atime_flag[(mode & no_atime) >> 4]
|
||||
#endif
|
||||
|
||||
, permissions);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef O_NOATIME
|
||||
// O_NOATIME is not allowed for files we don't own
|
||||
// so, if we get EPERM when we try to open with it
|
||||
// try again without O_NOATIME
|
||||
if (m_fd == -1 && (mode & no_atime) && errno == EPERM)
|
||||
{
|
||||
mode &= ~no_atime;
|
||||
m_fd = ::open(path.c_str()
|
||||
, mode_array[mode & rw_mask]
|
||||
| no_buffer_flag[(mode & no_buffer) >> 2]
|
||||
, permissions);
|
||||
}
|
||||
#endif
|
||||
if (m_fd == -1)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue