Duplicate :
|
If you lock a byte range, call it L1, and then lock another partly-overlapping byte range, L2, and, finally, unlock L2, the kernel will release the lock on the subrange of L1 that was overlapped by L2, thereby allowing other programs to access that subrange in violation of L1. Reproducible on Solaris and Linux with the attached program; should not be reproducible on Windows. Implementing non-overlapping file locks would solve this problem.
|