From 89ac7eca5e1d17d7dc949b2fd0a59a5e83abf90f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 6 Jul 2020 04:20:12 +0000 Subject: [PATCH] inboxidle: warn on inotify_add_watch failures inotify_add_watch(2), open(2), stat(2) may all fail due to permissions errors, especially when running -nntpd/-imapd as `nobody' as recommended. --- lib/PublicInbox/InboxIdle.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/InboxIdle.pm b/lib/PublicInbox/InboxIdle.pm index bdb30284..0cdd2e2a 100644 --- a/lib/PublicInbox/InboxIdle.pm +++ b/lib/PublicInbox/InboxIdle.pm @@ -41,8 +41,11 @@ sub in2_arm ($$) { # PublicInbox::Config::each_inbox callback $cur->[0] = $ibx; my $lock = "$dir/".($ibx->version >= 2 ? 'inbox.lock' : 'ssoma.lock'); - my $w = $cur->[1] = $inot->watch($lock, $IN_MODIFY); - $self->{on_unlock}->{$w->name} = $ibx; + if (my $w = $cur->[1] = $inot->watch($lock, $IN_MODIFY)) { + $self->{on_unlock}->{$w->name} = $ibx; + } else { + warn "E: ".ref($inot)."->watch($lock, IN_MODIFY) failed: $!\n"; + } # TODO: detect deleted packs (and possibly other files) } -- 2.48.1