[nagiosplug] Fix GCC's -Wuninitialized warnings

Nagios Plugin Development nagios-plugins at users.sourceforge.net
Tue Sep 10 23:00:28 CEST 2013


 Module: nagiosplug
 Branch: master
 Commit: d4a781817cbe1c6168e0687aea968b7a6f348abe
 Author: Holger Weiss <holger at zedat.fu-berlin.de>
   Date: Tue Sep 10 20:52:13 2013 +0200
    URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=d4a7818

Fix GCC's -Wuninitialized warnings

Fix the issues found by GCC when the -Wuninitialized flag is specified.

---

 lib/tests/test_disk.c |    2 +-
 plugins/check_http.c  |   24 ++++++++++++------------
 plugins/check_procs.c |    2 +-
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/lib/tests/test_disk.c b/lib/tests/test_disk.c
index 58eb8f1..f6477ac 100644
--- a/lib/tests/test_disk.c
+++ b/lib/tests/test_disk.c
@@ -34,7 +34,7 @@ main (int argc, char **argv)
 	struct name_list *dummy_mountlist = NULL;
 	struct name_list *temp_name;
 	struct parameter_list *paths = NULL;
-	struct parameter_list *p, *prev, *last;
+	struct parameter_list *p, *prev = NULL, *last = NULL;
 
 	struct mount_entry *dummy_mount_list;
 	struct mount_entry *me;
diff --git a/plugins/check_http.c b/plugins/check_http.c
index c44bb3a..ecd832f 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -855,18 +855,18 @@ check_http (void)
   char *full_page_new;
   char *buf;
   char *pos;
-  long microsec;
-  double elapsed_time;
-  long microsec_connect;
-  double elapsed_time_connect;
-  long microsec_ssl;
-  double elapsed_time_ssl;
-  long microsec_firstbyte;
-  double elapsed_time_firstbyte;
-  long microsec_headers;
-  double elapsed_time_headers;
-  long microsec_transfer;
-  double elapsed_time_transfer;
+  long microsec = 0L;
+  double elapsed_time = 0.0;
+  long microsec_connect = 0L;
+  double elapsed_time_connect = 0.0;
+  long microsec_ssl = 0L;
+  double elapsed_time_ssl = 0.0;
+  long microsec_firstbyte = 0L;
+  double elapsed_time_firstbyte = 0.0;
+  long microsec_headers = 0L;
+  double elapsed_time_headers = 0.0;
+  long microsec_transfer = 0L;
+  double elapsed_time_transfer = 0.0;
   int page_len = 0;
   int result = STATE_OK;
 
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index d09bd8b..d20b027 100644
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
@@ -150,7 +150,7 @@ main (int argc, char **argv)
 	int crit = 0; /* number of processes in crit state */
 	int i = 0, j = 0;
 	int result = STATE_UNKNOWN;
-	int ret;
+	int ret = 0;
 	output chld_out, chld_err;
 
 	setlocale (LC_ALL, "");





More information about the Commits mailing list