[interprocess] Bug in os_file_functions.hpp

Hi, I've just tried to use the file_locks from the boost trunk, and stumbled across a bug (well, two related bugs, really) when using the try_lock* metods. The problem occurs on linux systems only. The try_acquire_file_lock_sharable and try_acquire_file_lock functions both have the following code in them: int ret = ::fcntl(hnd, F_SETLK, &lock); if(ret == -1){ return (errno != EAGAIN && errno != EACCES) ? acquired = false, true : false; } I believe this should be changed into int ret = ::fcntl(hnd, F_SETLK, &lock); if(ret == -1){ return (errno == EAGAIN || errno == EACCES) ? acquired = false, true : false; } (its the errno checking line that is changed) Without my fix the result of trying to lock a lock that someone else has is an exception. Cheers Lars

Lars Hagström wrote:
Hi,
I've just tried to use the file_locks from the boost trunk, and stumbled across a bug (well, two related bugs, really) when using the try_lock* metods. The problem occurs on linux systems only.
Thanks, fixed in SVN. I'll merge it to release in a few days. Regards, Ion

Excellent! Ion Gaztañaga wrote:
Lars Hagström wrote:
Hi,
I've just tried to use the file_locks from the boost trunk, and stumbled across a bug (well, two related bugs, really) when using the try_lock* metods. The problem occurs on linux systems only.
Thanks, fixed in SVN. I'll merge it to release in a few days.
Regards,
Ion _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Ion Gaztañaga
-
Lars Hagström