Subject: [Boost-bugs] [Boost C++ Libraries] #4218: Bug in linux version of function boost::interprocess::set_file_pointer
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-05-14 16:04:28
#4218: Bug in linux version of function boost::interprocess::set_file_pointer
---------------------------------+------------------------------------------
Reporter: im.valdik@⦠| Owner: igaztanaga
Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: interprocess
Version: Boost 1.44.0 | Severity: Problem
Keywords: |
---------------------------------+------------------------------------------
{{{
inline bool set_file_pointer(file_handle_t hnd, offset_t off, file_pos_t
pos)
{ return off == ::lseek(hnd, off, (int)pos); }
}}}
Comparision "off == ::lseek(...)" is correct only if user is setting
pointer from the begining of the file 'file_begin'. But if user is setting
file pointer to zero from 'file_end' (setting file pointer to the end of
file) set_file_pointer function will return false, even if lseek didn't
failed.
I think its better to change code to something like this
{{{
inline bool set_file_pointer(file_handle_t hnd, offset_t off, file_pos_t
pos)
{ return -1 != ::lseek(hnd, off, (int)pos); }
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4218> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:03 UTC