From 1e3c7775388ad3dce52626cf476def567b066411 Mon Sep 17 00:00:00 2001 From: opensides Date: Sat, 27 Mar 2010 23:29:07 +0000 Subject: [PATCH] - Corrected open perl function, corrected variable passing to open and close git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17318 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/client/events/krb5.pm | 15 ++++++----- gosa-si/client/events/load_reporter.pm | 35 ++++++++++++++------------ 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/gosa-si/client/events/krb5.pm b/gosa-si/client/events/krb5.pm index c0cc930a6..30d23e008 100644 --- a/gosa-si/client/events/krb5.pm +++ b/gosa-si/client/events/krb5.pm @@ -1,5 +1,14 @@ package krb5; + + +use strict; +use warnings; + use Exporter; +use GOSA::GosaSupportDaemon; +use Authen::Krb5; +use Authen::Krb5::Admin qw(:constants); + @ISA = qw(Exporter); my @events = ( "get_events", @@ -17,12 +26,6 @@ my @events = ( ); @EXPORT = @events; -use strict; -use warnings; -use GOSA::GosaSupportDaemon; -use Authen::Krb5; -use Authen::Krb5::Admin qw(:constants); - BEGIN {} END {} diff --git a/gosa-si/client/events/load_reporter.pm b/gosa-si/client/events/load_reporter.pm index d68f28107..9227b729c 100644 --- a/gosa-si/client/events/load_reporter.pm +++ b/gosa-si/client/events/load_reporter.pm @@ -1,22 +1,25 @@ package load_reporter; -use Exporter; -@ISA = qw(Exporter); -my @events = ( - "get_events", - "get_terminal_server", - "get_load", - "report_load", - "set_terminal_server", - ); -@EXPORT = @events; + use strict; use warnings; +use Exporter; + use GOSA::GosaSupportDaemon; BEGIN {} END {} +@ISA = qw(Exporter); +my @events = ( + "get_events", + "get_terminal_server", + "get_load", + "report_load", + "set_terminal_server", + ); +@EXPORT = @events; + my $ts_load_file; my $waiting_for_ts_info; my %cfg_defaults = ( @@ -55,9 +58,9 @@ sub get_load my $file = "/proc/loadavg"; if ((not -f $file) || (not -r $file)) { return } - open(FHD, "<$file"); - my $line = ; - close(FHD); + open($FHD, "<", "$file"); + my $line = <$FHD>; + close($FHD); chomp($line); $out_msg = &create_xml_string(&create_xml_hash("report_load", $target, $source, $line)); @@ -83,9 +86,9 @@ sub set_terminal_server { $file_content .= "$ts $load\n"; } - open(FHD, ">$ts_load_file.part"); - printf FHD $file_content; - close FHD; + open($FHD, ">", "$ts_load_file.part"); + printf $FHD $file_content; + close($FHD); system("mv $ts_load_file.part $ts_load_file"); &main::daemon_log("INFO: Wrote terminal server load information to $ts_load_file", 5); -- 2.30.2