[Openswan dev] [PATCH] silent wrong uninitialized compiler warning

Gilles Espinasse g.esp at free.fr
Sat Jun 20 05:32:05 EDT 2009


(gcc-4.2.2)
/usr/src/openswan-2.6.22rc2/programs/pluto/rnd.c:175: warning: 'rnd_dev' may be used uninitialized in this function
/usr/src/openswan-2.6.22rc2/programs/pluto/nat_traversal.c:673: warning: 'r' may be used uninitialized in this function

Signed-off-by: Gilles Espinasse <g.esp at free.fr>
---
 programs/pluto/nat_traversal.c |    2 +-
 programs/pluto/rnd.c           |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/programs/pluto/nat_traversal.c b/programs/pluto/nat_traversal.c
index 485404a..7f07cbd 100644
--- a/programs/pluto/nat_traversal.c
+++ b/programs/pluto/nat_traversal.c
@@ -670,7 +670,7 @@ void nat_traversal_show_result (u_int32_t nt, u_int16_t sport)
 
 int nat_traversal_espinudp_socket (int sk, const char *fam, u_int32_t type)
 {
-	int r;
+	int r = 0;
 	static enum { auto_style, new_style, old_style } style = auto_style;
 
 	if (style == auto_style || style == new_style) {
diff --git a/programs/pluto/rnd.c b/programs/pluto/rnd.c
index dab0a02..a713cd9 100644
--- a/programs/pluto/rnd.c
+++ b/programs/pluto/rnd.c
@@ -172,7 +172,7 @@ init_rnd_pool(void)
 #ifndef HAVE_LIBNSS
     unsigned int i;
     unsigned int max_rnd_devices = elemsof(random_devices)+1;
-    const char *rnd_dev;
+    const char *rnd_dev = NULL;
 
     if(random_fd != -1) close(random_fd);
     random_fd = -1;
-- 
1.6.0.6



More information about the Dev mailing list