8000206: Uninitialized variable in PlainDatagramSocketImpl.c
Reviewed-by: dsamersoff, khazra, chegar
Contributed-by: John Zavgren <john.zavgren@oracle.com>
--- 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;
}