Opened 12 years ago

Closed 12 years ago

#4218 closed Bugs (fixed)

Bug in linux version of function boost::interprocess::set_file_pointer

Reported by: im.valdik@… Owned by: Ion Gaztañaga
Milestone: Boost 1.45.0 Component: interprocess
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:

Description

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); }

Change History (1)

comment:1 by Ion Gaztañaga, 12 years ago

Milestone: Boost 1.43.0Boost-1.45.0
Resolution: fixed
Status: newclosed

Fixed for Boost 1.45 in release branch

Note: See TracTickets for help on using tickets.