[PATCH]: Portability fixes
Martin Buchholz
martinrb at google.com
Wed Jan 28 22:27:19 UTC 2009
I've pushed the fix for UNIXProcess into the tl forest.
Thanks to Christos and Alan for making it happen.
Let's aim for future changes as speedy as this one.
Martin
On Wed, Jan 28, 2009 at 13:52, Alan Bateman <Alan.Bateman at sun.com> wrote:
> 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20090128/6caa1633/attachment.html>
More information about the core-libs-dev
mailing list