Skip to content

Commit 3b4cb7c

Browse files
committed
Auto merge of #4116 - alexcrichton:enotsupp, r=Mark-Simulacrum
Ignore ENOTSUP in file locking on Linux too Apparently there are some filesystems that return this! Closes #4096
2 parents 30ebc17 + 7e3e9b2 commit 3b4cb7c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/cargo/util/flock.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,11 @@ fn acquire(config: &Config,
271271
match try() {
272272
Ok(()) => return Ok(()),
273273

274-
// Like above, where we ignore file locking on NFS mounts on Linux, we
275-
// do the same on OSX here. Note that ENOTSUP is an OSX_specific
276-
// constant.
277-
#[cfg(target_os = "macos")]
274+
// In addition to ignoring NFS which is commonly not working we also
275+
// just ignore locking on filesystems that look like they don't
276+
// implement file locking. We detect that here via the return value of
277+
// locking (e.g. inspecting errno).
278+
#[cfg(unix)]
278279
Err(ref e) if e.raw_os_error() == Some(libc::ENOTSUP) => return Ok(()),
279280

280281
#[cfg(target_os = "linux")]

0 commit comments

Comments
 (0)