RFR: 8254270: linux 32 bit build doesn't compile libjdwp/log_messages.c [v5]

Coleen Phillimore coleenp at openjdk.java.net
Fri Nov 6 14:30:16 UTC 2020


On Fri, 6 Nov 2020 14:03:10 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   More.
>
> src/jdk.jdwp.agent/share/native/libjdwp/log_messages.c line 86:
> 
>> 84:     char tmp[20];
>> 85:     snprintf(tmp, sizeof(tmp), "%.3d", millisecs);
>> 86:     snprintf(tbuf, ltbuf, "%s.%s %s", timestamp_date_time, tmp, timestamp_timezone);
> 
> Sorry, Coleen, we still miss the precision limit in the second printf.
> 
> char tmp[20];
> snprintf(tmp, sizeof(tmp), "%.3d", millisecs);
> snprintf(tbuf, ltbuf, "%s.%.3s %s", timestamp_date_time, tmp, timestamp_timezone);
>                           ^^^^
> 
> The point was to first print the digit with enough space to hold its stringified value (20 is more than enough). We need to print that one with .3d to get zero-padding to three digits if the value is <100.
> 
> Then to print that stringified version with ".3s" since, in contrast to %d, with %s the precision actually works as a limiter.
> 
> Thanks for your patience.

Thanks for all your help and quick responses.  I made that change, see new commit.  I should realize that there are no simple changes!

-------------

PR: https://git.openjdk.java.net/jdk/pull/1067


More information about the serviceability-dev mailing list