mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-05 15:01:40 +09:00
acquireLock treated every openSync error as lock contention, so permission/path/IO failures and planted directories/symlinks waited the full LOCK_WAIT_MS and surfaced as policy-state-lock-timeout on every MCP call. It also used openSync('wx'), which can follow a dangling symlink at the lock path and create the target.
Create with O_EXCL|O_NOFOLLOW where supported, treat only EEXIST as contention, map ELOOP and non-regular lstat results to an explicit path-type error, and throw other codes immediately as policy-state-lock-error. Normal live/dead regular-lock behavior is unchanged. Extend the lock tests with directory and dangling-symlink cases and update the symlinked-FIFO case to assert an immediate path error with no target removal.