8000206: Uninitialized variable in PlainDatagramSocketImpl.c
authorchegar
Fri, 19 Oct 2012 11:43:59 +0100
changeset 14195 57fe6c437882
parent 14194 971f46db533d
child 14196 1ebcd181a423
8000206: Uninitialized variable in PlainDatagramSocketImpl.c Reviewed-by: dsamersoff, khazra, chegar Contributed-by: John Zavgren <john.zavgren@oracle.com>
jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
--- 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;
             }