[monitoring-plugins] Fix: Initialize values

Bernd Arnold git at monitoring-plugins.org
Thu Jul 26 07:40:15 CEST 2018


 Module: monitoring-plugins
 Branch: master
 Commit: 5a73671ec6299c480c90ec5b9f0f3d58397fbcfb
 Author: Bernd Arnold <wopfel at gmail.com>
   Date: Sat Jun  9 10:02:23 2018 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=5a73671

Fix: Initialize values

Otherwise, there's a warning about unitialized values:
Use of uninitialized value $hours in numeric gt (>) at ...
Use of uninitialized value $days in numeric gt (>) at ...

---

 plugins-scripts/check_uptime.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/plugins-scripts/check_uptime.pl b/plugins-scripts/check_uptime.pl
index 27dc93f..20234c8 100755
--- a/plugins-scripts/check_uptime.pl
+++ b/plugins-scripts/check_uptime.pl
@@ -85,6 +85,7 @@ if ( $uptime_seconds !~ /^\d+$/ ) {
 
 my ( $secs, $mins, $hours, $days, $weeks );
 $secs = $uptime_seconds;
+$mins = $hours = $days = $weeks = 0;
 if ( $secs > 100 ) {
 	$mins = int( $secs / 60 );
 	$secs -= $mins * 60;



More information about the Commits mailing list