Log error before croaking and show path to file in the error message

This commit is contained in:
Isaac Connor 2016-02-19 10:59:40 -05:00
parent 3a512f87a5
commit 327a01cb20
1 changed files with 5 additions and 2 deletions

View File

@ -62,7 +62,10 @@ sub open
local *sfh;
#sysopen( *sfh, $conn->{path}, O_NONBLOCK|O_RDONLY ) or croak( "Can't sysopen: $!" );
#open( *sfh, "<".$conn->{path} ) or croak( "Can't open: $!" );
open( *sfh, "+<", $self->{path} ) or croak( "Can't open: $!" );
if ( ! open( *sfh, "+<", $self->{path} ) ) {
Error( "Can't open file at $$self{path}: $!" );
croak( "Can't open file at $$self{path}: $!" );
}
$self->{state} = 'open';
$self->{handle} = *sfh;
}
@ -73,7 +76,7 @@ __END__
=head1 NAME
ZoneMinder::Database - Perl extension for blah blah blah
ZoneMinder::Trigger::Channel::File - ZOneMinder object for a file based trigger channel
=head1 SYNOPSIS