From: Eric Wong Date: Mon, 6 Jul 2020 04:20:12 +0000 (+0000) Subject: inboxidle: warn on inotify_add_watch failures X-Git-Tag: v1.6.0~301 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=89ac7eca5e1d17d7dc949b2fd0a59a5e83abf90f;p=public-inbox.git 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. --- 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) }