From 2fa83301f7851cf49b36fc547f2c820675b92469 Mon Sep 17 00:00:00 2001 From: stan Date: Thu, 12 Jan 2006 00:21:18 +0000 Subject: [PATCH] Failure to open debug log only a warning. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1782 e3e1d417-86f3-4887-817a-d78f3d33393f --- scripts/ZoneMinder/lib/ZoneMinder/Debug.pm | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Debug.pm b/scripts/ZoneMinder/lib/ZoneMinder/Debug.pm index da245a927..f75c538f0 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Debug.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Debug.pm @@ -235,14 +235,21 @@ sub _dbgOpenLog if ( $dbg_to_log ) { $dbg_log_file = ZM_PATH_LOGS."/".$dbg_id.".log"; - open( LOG, ">>".$dbg_log_file ) or Fatal( "Can't open log file '$dbg_log_file': $!" ); - LOG->autoflush(); - - my $web_uid = (getpwnam( ZM_WEB_USER ))[2]; - my $web_gid = (getgrnam( ZM_WEB_GROUP ))[2]; - if ( $> != $web_uid ) + if ( open( LOG, ">>".$dbg_log_file ) ) { - chown( $web_uid, $web_gid, $dbg_log_file ) or die( "Can't change permissions on log file: $!" ) + LOG->autoflush(); + + my $web_uid = (getpwnam( ZM_WEB_USER ))[2]; + my $web_gid = (getgrnam( ZM_WEB_GROUP ))[2]; + if ( $> == 0 ) + { + chown( $web_uid, $web_gid, $dbg_log_file ) or die( "Can't change permissions on log file: $!" ) + } + } + else + { + warn( "Can't open log file '$dbg_log_file': $!" ); + $dbg_to_log = 0; } } }