[base] POSIX File::Unlock() didn't actually unlock file.
Unlock passed F_UNLCK as cmd to fcntl(). It's supposed to be in flock.type. As a result, the file is not actually unlocked. F_UNLCK is 2 (on OSX and Linux), cmd 2 is F_SETFD, which sets flags on the file descriptor, which is why the call succeeds. The only flag defined appears to be FD_CLOEXEC, which is the low-order bit of the third parameter. Since the parameter passed to fcntl is aligned at off_t or better, Unlock() will clear FD_CLOEXEC if set. As best I can tell cases with FD_CLOEXEC do not use base::File. [Addendum: File::Lock/Unlock was landed for leveldb, and at this time Chromium's only use is in third_party/leveldatabase/env_chromium.cc.] BUG=565787 Review URL: https://codereview.chromium.org/1491743009 Cr-Commit-Position: refs/heads/master@{#364497}
Showing
Please register or sign in to comment