merged linux permission issue fix from RC_0_16

This commit is contained in:
Arvid Norberg 2012-07-13 04:04:56 +00:00
parent 3d7dc768da
commit a62a2a5b6c
2 changed files with 21 additions and 2 deletions

View File

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

View File

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