Modify

Ticket #4218 (closed Bugs: fixed)

Opened 4 years ago

Last modified 4 years ago

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

Reported by: im.valdik@… Owned by: igaztanaga
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); }

Attachments

Change History

comment:1 Changed 4 years ago by igaztanaga

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from Boost 1.43.0 to Boost-1.45.0

Fixed for Boost 1.45 in release branch

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.