Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3368)

Unified Diff: base/files/file_posix.cc

Issue 1491743009: [base] POSIX File::Unlock() didn't actually unlock file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move lock tests to new file, with test fixture, share code. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« base/files/file_locking_unittest.cc ('K') | « base/files/file_locking_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_posix.cc
diff --git a/base/files/file_posix.cc b/base/files/file_posix.cc
index 72fb515814798adb292215e7fb62d21d80ebd7c2..7278db7273c8d0929c1dfd9cb977ec6142d9c4a2 100644
--- a/base/files/file_posix.cc
+++ b/base/files/file_posix.cc
@@ -70,11 +70,11 @@ int CallFutimes(PlatformFile file, const struct timeval times[2]) {
File::Error CallFcntlFlock(PlatformFile file, bool do_lock) {
struct flock lock;
- lock.l_type = F_WRLCK;
+ lock.l_type = do_lock ? F_WRLCK : F_UNLCK;
lock.l_whence = SEEK_SET;
lock.l_start = 0;
lock.l_len = 0; // Lock entire file.
- if (HANDLE_EINTR(fcntl(file, do_lock ? F_SETLK : F_UNLCK, &lock)) == -1)
+ if (HANDLE_EINTR(fcntl(file, F_SETLK, &lock)) == -1)
return File::OSErrorToFileError(errno);
return File::FILE_OK;
}
« base/files/file_locking_unittest.cc ('K') | « base/files/file_locking_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698