Martin Buchholz wrote:
Christos, thanks for the bug report.
For low level code like this, it's almost always a mistake
(my mistake, that is; I am the author)
to use the locale-dependent functions like isdigit.
Still, I am surprised to see a real failure with isdigit(negative char).
I prefer the following fix for UNIXProcess_md.c:
(and would be willing to submit it on Christos' behalf)
(I'm not going to comment on the changes to AddressImpl.c,
except to suggest considering ASCII-specific functions as well.)
diff --git a/src/solaris/native/java/lang/UNIXProcess_md.c
b/src/solaris/native/java/lang/UNIXProcess_md.c
--- a/src/solaris/native/java/lang/UNIXProcess_md.c
+++ b/src/solaris/native/java/lang/UNIXProcess_md.c
@@ -260,6 +260,12 @@
}
static int
+isAsciiDigit(char c)
+{
+ return c >= '0' && c <= '9';
+}
+
+static int
closeDescriptors(void)
{
DIR *dp;
@@ -284,7 +290,7 @@
*/
while ((dirp = readdir64(dp)) != NULL) {
int fd;
- if (isdigit(dirp->d_name[0]) &&
+ if (isAsciiDigit(dirp->d_name[0]) &&
(fd = strtol(dirp->d_name, NULL, 10)) >= from_fd + 2)
close(fd);
}
Martin
This looks good to me too. I've created a bug to track this:
6798822: (process) Non-portable use of isdigit in
src/solaris/native/java/lang/UNIXProcess_md.c
We should forward the portability issues with the networking code to
net-dev.
-Alan.