changeset 14195:57fe6c437882

8000206: Uninitialized variable in PlainDatagramSocketImpl.c Reviewed-by: dsamersoff, khazra, chegar Contributed-by: John Zavgren <john.zavgren@oracle.com>
author chegar
date Fri, 19 Oct 2012 11:43:59 +0100
parents 971f46db533d
children 1ebcd181a423
files jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
diffstat 1 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Thu Oct 18 01:14:00 2012 -0700
+++ b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Fri Oct 19 11:43:59 2012 +0100
@@ -1318,10 +1318,8 @@
                                                       jobject value) {
     int fd;
     int level, optname, optlen;
-    union {
-        int i;
-        char c;
-    } optval;
+    int optval;
+    optlen = sizeof(int);
 
     /*
      * Check that socket hasn't been closed
@@ -1381,8 +1379,7 @@
                 fid =  (*env)->GetFieldID(env, cls, "value", "I");
                 CHECK_NULL(fid);
 
-                optval.i = (*env)->GetIntField(env, value, fid);
-                optlen = sizeof(optval.i);
+                optval = (*env)->GetIntField(env, value, fid);
                 break;
             }
 
@@ -1401,8 +1398,7 @@
                 on = (*env)->GetBooleanField(env, value, fid);
 
                 /* SO_REUSEADDR or SO_BROADCAST */
-                optval.i = (on ? 1 : 0);
-                optlen = sizeof(optval.i);
+                optval = (on ? 1 : 0);
 
                 break;
             }