File tree Expand file tree Collapse file tree 1 file changed +8
-24
lines changed Expand file tree Collapse file tree 1 file changed +8
-24
lines changed Original file line number Diff line number Diff line change @@ -60,36 +60,20 @@ FileLock::~FileLock()
60
60
}
61
61
}
62
62
63
- static bool IsWSL ()
64
- {
65
- struct utsname uname_data;
66
- return uname (&uname_data) == 0 && std::string (uname_data.version ).find (" Microsoft" ) != std::string::npos;
67
- }
68
-
69
63
bool FileLock::TryLock ()
70
64
{
71
65
if (fd == -1 ) {
72
66
return false ;
73
67
}
74
68
75
- // Exclusive file locking is broken on WSL using fcntl (issue #18622)
76
- // This workaround can be removed once the bug on WSL is fixed
77
- static const bool is_wsl = IsWSL ();
78
- if (is_wsl) {
79
- if (flock (fd, LOCK_EX | LOCK_NB) == -1 ) {
80
- reason = GetErrorReason ();
81
- return false ;
82
- }
83
- } else {
84
- struct flock lock;
85
- lock.l_type = F_WRLCK;
86
- lock.l_whence = SEEK_SET;
87
- lock.l_start = 0 ;
88
- lock.l_len = 0 ;
89
- if (fcntl (fd, F_SETLK, &lock) == -1 ) {
90
- reason = GetErrorReason ();
91
- return false ;
92
- }
69
+ struct flock lock;
70
+ lock.l_type = F_WRLCK;
71
+ lock.l_whence = SEEK_SET;
72
+ lock.l_start = 0 ;
73
+ lock.l_len = 0 ;
74
+ if (fcntl (fd, F_SETLK, &lock) == -1 ) {
75
+ reason = GetErrorReason ();
76
+ return false ;
93
77
}
94
78
95
79
return true ;
You can’t perform that action at this time.
0 commit comments