Skip to content

Commit

Permalink
Merge pull request #4948 from rjbou/lockf-win
Browse files Browse the repository at this point in the history
lockf: catch `Unix.EACCES`
  • Loading branch information
rjbou committed Jan 21, 2022
2 parents 73fb279 + 42085f7 commit f70548b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ users)
* [BUG] check Unix.has_symlink before using Unix.symlink [#4962 @jonahbeckford]
* OpamCudf: provide machine-readable information on conflicts caused by cycles [#4039 @gasche]
* Remove memoization from `best_effort ()` to allow for multiple different settings during the same session (useful for libaray users) [#4805 @LasseBlaauwbroek]
* [BUG] Catch `EACCES` in lock function [#4948 @oandrieu - fix #4944]

## Test
* Update crowbar with compare functions [#4918 @rjbou]
Expand Down
3 changes: 2 additions & 1 deletion src/core/opamSystem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,8 @@ let rec flock_update
if Sys.win32 && kind <> `Lock_none then
Unix.(lockf fd F_ULOCK 0);
Unix.lockf fd (unix_lock_op ~dontblock:true flag) 0
with Unix.Unix_error (Unix.EAGAIN,_,_) ->
with Unix.Unix_error (Unix.EAGAIN,_,_)
| Unix.Unix_error (Unix.EACCES,_,_) ->
if dontblock then
OpamConsole.error_and_exit `Locked
"Another process has locked %s and non blocking mode enabled"
Expand Down

0 comments on commit f70548b

Please sign in to comment.