select returns EINTR when HUP'd. This is not fatal. Handling this gracefully reduces log spam

This commit is contained in:
Isaac Connor 2020-11-21 09:12:41 -05:00
parent 0d71b18097
commit 271dcbc4e8
1 changed files with 5 additions and 2 deletions

View File

@ -27,7 +27,7 @@ use strict;
use ZoneMinder;
use Getopt::Long;
use autouse 'Pod::Usage'=>qw(pod2usage);
use POSIX qw/strftime EPIPE/;
use POSIX qw/strftime EPIPE EINTR/;
use Socket;
use Data::Dumper;
use Module::Load::Conditional qw{can_load};
@ -191,7 +191,10 @@ if ( $options{command} ) {
Fatal('Bogus descriptor');
}
} elsif ( $nfound < 0 ) {
if ( $! == EPIPE ) {
if ( $! == EINTR ) {
# Likely just SIGHUP
Debug("Can't select: $!");
} elsif ( $! == EPIPE ) {
Error("Can't select: $!");
} else {
Fatal("Can't select: $!");