From 6602b73d670d8f516f46cb1516a978a10025a25c Mon Sep 17 00:00:00 2001 From: Aron Heinecke Date: Fri, 19 Mar 2021 19:41:51 +0100 Subject: [PATCH] Backport #285 display correct inotify limit error Signed-off-by: Aron Heinecke --- CHANGELOG.md | 4 +++- src/lib.rs | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68c005f4..54bd8ed7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,10 @@ ## 4.0.16 (future) - FIX: Report events promptly on Linux, even when many occur in rapid succession. [#268] +- FIX: Display proper error message when reaching inotify limits on linux. [#289] [#268]: https://github.com/notify-rs/notify/pull/268 +[#289]: https://github.com/notify-rs/notify/pull/289 ## 4.0.15 (2020-01-07) @@ -85,7 +87,7 @@ - META: Change commit message style: commits are now prefixed by a `[topic]`. - FIX: Make sure debounced watcher terminates. [#170] - FIX: \[Linux\] Remove thread wake-up on timeout (introduced in 4.0.5 by error). [#174] -- FIX: Restore compatibility with Rust before 1.30.0. [`eab75118`] +- FIX: Restore compatibility with Rust before 1.30.0. [`eab75118`] - META: Enforce compatibility with Rust 1.26.1 via CI. [`50924cd6`] - META: Add maintenance status badge. [`ecd686ba`] - DOCS: Freeze v4 branch (2018-10-05) [`8310b2cc`] — and subsequently unfreeze it. (2019-01-19) [`20c40f99`], [`c00da47c`] diff --git a/src/lib.rs b/src/lib.rs index a1e28d06..42571810 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -520,6 +520,11 @@ impl StdError for Error { impl From for Error { fn from(err: io::Error) -> Error { + // do not report inotify limits as "no more space" on linux #266 + #[cfg(target_os = "linux")] + if err.raw_os_error() == Some(28) { + return Error::Generic(String::from("Can't watch (more) files, limit on the total number of inotify watches reached")) + } Error::Io(err) } }