Made shared memory read failure non-fatal.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@604 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2003-07-05 20:39:04 +00:00
parent 4b8c56dee6
commit 5a04fd6d33
1 changed files with 3 additions and 2 deletions

View File

@ -192,13 +192,14 @@ sleep( START_DELAY );
my $filters = GetFilters( $monitor ); my $filters = GetFilters( $monitor );
my $last_action = 0; my $last_action = 0;
my $size = 24; # We only need the first 16 bytes really for the last event count my $size = 28; # We only need the first 28 bytes really for the last event count
my $key = hex(ZM_SHM_KEY)|$monitor; my $key = hex(ZM_SHM_KEY)|$monitor;
my $shmid = shmget( $key, $size, 0 ) || die( "Can't get shared memory id: $!" ); my $shmid = shmget( $key, $size, 0 ) || die( "Can't get shared memory id: $!" );
while( 1 ) while( 1 )
{ {
shmread( $shmid, $last_event_id, 20, 4 ) || die( "Can't read from shared memory: $!" ); next if ( !shmread( $shmid, $last_event_id, 24, 4 ) );
$last_event_id = unpack( "l", $last_event_id ); $last_event_id = unpack( "l", $last_event_id );
print( "Last event generated is $last_event_id\n" ) if ( VERBOSE ); print( "Last event generated is $last_event_id\n" ) if ( VERBOSE );