Code

Added flocks to daemon_log.
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 11 Mar 2009 12:43:53 +0000 (12:43 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 11 Mar 2009 12:43:53 +0000 (12:43 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13526 594d385d-05f5-0310-b6e9-bd551577e9d8

trunk/gosa-si/gosa-si-server

index 9191d3e858a580cc590816c1af73351ee606f9e7..d13b4212d51357cd98b92a388f633224541a5293 100755 (executable)
@@ -28,7 +28,7 @@ use Getopt::Long;
 use Config::IniFiles;
 use POSIX;
 
-use Fcntl;
+use Fcntl qw/:flock/;
 use IO::Socket::INET;
 use IO::Handle;
 use IO::Select;
@@ -352,7 +352,10 @@ sub daemon_log {
             my $name = $prg;
 
             my $log_msg = "$month $monthday $hours:$minutes:$seconds $name $msg\n";
+                       flock(LOG_HANDLE, LOCK_EX);
+                       seek(LOG_HANDLE, 0, 2);
             print LOG_HANDLE $log_msg;
+                       flock(LOG_HANDLE, LOCK_UN);
             if( $foreground ) { 
                 print STDERR $log_msg;
             }