Hi Alan,
Yes, I will assign 6799040 to myself and work with Christos to finalize
the networking changes.
Thanks,
-Chris.
Alan Bateman wrote:
Christos mailed core-libs-dev yesterday with a few portability
issues.Anyone have cycles to look at the Inet4AddressImpl.c changes?
I've created 6799040 to track it. Martin has already pushed a changeset
to jdk7/tl/jdk for the UNIXProcess_md.c issue.
------------------------------------------------------------------------
Subject:
[PATCH]: Portability fixes
From:
chris...@zoulas.com (Christos Zoulas)
Date:
Wed, 28 Jan 2009 14:44:37 -0500
To:
core-libs-...@openjdk.java.net
To:
core-libs-...@openjdk.java.net
Hello,
Here are some simple changes for your consideration:
1. passing possibly negative values to isdigit is undefined behavior:
http://www.opengroup.org/onlinepubs/009695399/functions/isdigit.html
2. passing possibly negative values to isspace is undefined behavior:
http://www.opengroup.org/onlinepubs/009695399/functions/isspace.html
3. last is possibly uninitialized.
4. recvfrom argument should be socklen_t not int:
http://www.opengroup.org/onlinepubs/007908775/xns/recvfrom.html
Thanks,
christos
diff -r fc30e7f4b9b3 src/solaris/native/java/lang/UNIXProcess_md.c
--- a/src/solaris/native/java/lang/UNIXProcess_md.c Fri Jan 16 11:24:18
2009 -0500
+++ b/src/solaris/native/java/lang/UNIXProcess_md.c Mon Jan 22 16:25:36
2009 -0500
@@ -377,7 +377,7 @@
*/
while ((dirp = readdir(dp)) != NULL) {
int fd;
- if (isdigit(dirp->d_name[0]) &&
+ if (isdigit((unsigned char)dirp->d_name[0]) &&
(fd = strtol(dirp->d_name, NULL, 10)) >= from_fd + 2)
close(fd);
}
diff -r fc30e7f4b9b3 src/solaris/native/java/net/Inet4AddressImpl.c
--- a/src/solaris/native/java/net/Inet4AddressImpl.c Fri Jan 16 11:24:18
2009 -0500
+++ b/src/solaris/native/java/net/Inet4AddressImpl.c Mon Jan 22 16:25:36
2009 -0500
@@ -155,7 +155,7 @@
* Workaround for Solaris bug 4160367 - if a hostname contains a
* white space then 0.0.0.0 is returned
*/
- if (isspace(hostname[0])) {
+ if (isspace((unsigned char)hostname[0])) {
JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
(char *)hostname);
JNU_ReleaseStringPlatformChars(env, host, hostname);
@@ -172,7 +172,7 @@
return NULL;
} else {
int i = 0;
- struct addrinfo *itr, *last, *iterator = res;
+ struct addrinfo *itr, *last = NULL, *iterator = res;
while (iterator != NULL) {
int skip = 0;
itr = resNew;
@@ -603,7 +603,8 @@
ping4(JNIEnv *env, jint fd, struct sockaddr_in* him, jint timeout,
struct sockaddr_in* netif, jint ttl) {
jint size;
- jint n, len, hlen1, icmplen;
+ jint n, hlen1, icmplen;
+ socklen_t len;
char sendbuf[1500];
char recvbuf[1500];
struct icmp *icmp;