[Openvas-commits] r9410 - in trunk/openvas-libraries: . hg misc nasl

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Nov 16 12:43:47 CET 2010


Author: mwiegand
Date: 2010-11-16 12:43:46 +0100 (Tue, 16 Nov 2010)
New Revision: 9410

Modified:
   trunk/openvas-libraries/ChangeLog
   trunk/openvas-libraries/hg/hg_add_hosts.c
   trunk/openvas-libraries/misc/openvas_logging.c
   trunk/openvas-libraries/nasl/nasl_packet_forgery_v6.c
Log:
Addressed compiler warnings regarding uninitialized variables and
unused functions.

  * nasl/nasl_packet_forgery_v6.c (forge_icmp_v6_packet): Make sure
  routersolicit, routeradvert, neighborsolicit and neighboradvert are
  initialized before use.

  * hg/hg_add_hosts.c (hg_add_ipv6host_with_options): Addressed TODO,
  ensure c_hostname is initialized before use.

  * misc/openvas_logging.c (openvas_syslog_func): Removed superfluous
  function, logging to syslog is now handled by openvas_log_func.
  (openvas_log_func): Ensure log_domain_entry is initialized before use.


Modified: trunk/openvas-libraries/ChangeLog
===================================================================
--- trunk/openvas-libraries/ChangeLog	2010-11-16 11:27:46 UTC (rev 9409)
+++ trunk/openvas-libraries/ChangeLog	2010-11-16 11:43:46 UTC (rev 9410)
@@ -1,3 +1,19 @@
+2010-11-16  Michael Wiegand <michael.wiegand at greenbone.net>
+
+	Addressed compiler warnings regarding uninitialized variables and
+	unused functions.
+
+	* nasl/nasl_packet_forgery_v6.c (forge_icmp_v6_packet): Make sure
+	routersolicit, routeradvert, neighborsolicit and neighboradvert are
+	initialized before use.
+
+	* hg/hg_add_hosts.c (hg_add_ipv6host_with_options): Addressed TODO,
+	ensure c_hostname is initialized before use.
+
+	* misc/openvas_logging.c (openvas_syslog_func): Removed superfluous
+	function, logging to syslog is now handled by openvas_log_func.
+	(openvas_log_func): Ensure log_domain_entry is initialized before use.
+
 2010-11-14  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
 
 	* base/CMakeLists.txt: Removed accidental change in last commit.

Modified: trunk/openvas-libraries/hg/hg_add_hosts.c
===================================================================
--- trunk/openvas-libraries/hg/hg_add_hosts.c	2010-11-16 11:27:46 UTC (rev 9409)
+++ trunk/openvas-libraries/hg/hg_add_hosts.c	2010-11-16 11:43:46 UTC (rev 9410)
@@ -559,9 +559,7 @@
                               struct in6_addr *ip, int alive, int netmask,
                               int use_max, struct in6_addr *ip_max)
 {
-  /** @TODO To be sane, shouldnt c_hostname be initialized to NULL? What is it
-   *        used for anyways? */
-  char *c_hostname;
+  char *c_hostname = NULL;
   struct hg_host *host;
   int i;
   char local_hostname[1024];

Modified: trunk/openvas-libraries/misc/openvas_logging.c
===================================================================
--- trunk/openvas-libraries/misc/openvas_logging.c	2010-11-16 11:27:46 UTC (rev 9409)
+++ trunk/openvas-libraries/misc/openvas_logging.c	2010-11-16 11:43:46 UTC (rev 9410)
@@ -337,51 +337,6 @@
 }
 
 /**
- * @brief Sends message to syslog.
- *
- * @param log_domain (ignored) A string containing the message's log domain.
- * @param log_level  Flags defining the message's log level.
- * @param message    A string containing the log message.
- * @param openvas_log_config_list (ignored) A pointer to the configuration
- *                                linked list.
- *
- * @TODO: syslog logging is now handled in openvas_log_func, do we need a
- * separate handler for this?
- */
-static void
-openvas_syslog_func (const char *log_domain, GLogLevelFlags log_level,
-                     const char *message, gpointer openvas_log_config_list)
-{
-  switch (log_level)
-    {
-    case G_LOG_FLAG_FATAL:
-      syslog (LOG_ALERT, "%s", message);
-      break;
-    case G_LOG_LEVEL_ERROR:
-      syslog (LOG_ERR, "%s", message);
-      break;
-    case G_LOG_LEVEL_CRITICAL:
-      syslog (LOG_CRIT, "%s", message);
-      break;
-    case G_LOG_LEVEL_WARNING:
-      syslog (LOG_WARNING, "%s", message);
-      break;
-    case G_LOG_LEVEL_MESSAGE:
-      syslog (LOG_NOTICE, "%s", message);
-      break;
-    case G_LOG_LEVEL_INFO:
-      syslog (LOG_INFO, "%s", message);
-      break;
-    case G_LOG_LEVEL_DEBUG:
-      syslog (LOG_DEBUG, "%s", message);
-      break;
-    default:
-      syslog (LOG_INFO, "%s", message);
-      break;
-    }
-}
-
-/**
  * @brief Creates the formatted string and outputs it to the log destination.
  *
  * @param log_domain A string containing the message's log domain.
@@ -401,7 +356,7 @@
 
   /* For link list operations. */
   GSList *log_domain_list_tmp;
-  openvas_logging_t *log_domain_entry;
+  openvas_logging_t *log_domain_entry = NULL;
 
   /* Channel to log through. */
   GIOChannel *channel;

Modified: trunk/openvas-libraries/nasl/nasl_packet_forgery_v6.c
===================================================================
--- trunk/openvas-libraries/nasl/nasl_packet_forgery_v6.c	2010-11-16 11:27:46 UTC (rev 9409)
+++ trunk/openvas-libraries/nasl/nasl_packet_forgery_v6.c	2010-11-16 11:43:46 UTC (rev 9410)
@@ -1191,10 +1191,10 @@
   struct ip6_hdr *ip6_icmp;
   int ip6_sz, size = 0, sz = 0;
   struct icmp6_hdr *icmp;
-  struct nd_router_solicit *routersolicit;
-  struct nd_router_advert *routeradvert;
-  struct nd_neighbor_solicit *neighborsolicit;
-  struct nd_neighbor_advert *neighboradvert;
+  struct nd_router_solicit *routersolicit = NULL;
+  struct nd_router_advert *routeradvert = NULL;
+  struct nd_neighbor_solicit *neighborsolicit = NULL;
+  struct nd_neighbor_advert *neighboradvert = NULL;
 
   char *data, *p;
   int len;



More information about the Openvas-commits mailing list