Skip to content

Commit 0b7fba7

Browse files
committed
8254270: linux 32 bit build doesn't compile libjdwp/log_messages.c
Reviewed-by: redestad, cjplummer, dholmes, stuefe
1 parent f5d36e6 commit 0b7fba7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/jdk.jdwp.agent/share/native/libjdwp/log_messages.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -78,9 +78,12 @@ get_time_stamp(char *tbuf, size_t ltbuf)
7878
"%d.%m.%Y %T", localtime(&t));
7979
(void)strftime(timestamp_timezone, TZ_SIZE,
8080
"%Z", localtime(&t));
81-
(void)snprintf(tbuf, ltbuf,
82-
"%s.%.3d %s", timestamp_date_time,
83-
(int)(millisecs), timestamp_timezone);
81+
82+
// Truncate milliseconds in buffer large enough to hold the
83+
// value which is always < 1000 (and so a maximum of 3 digits for "%.3d")
84+
char tmp[20];
85+
snprintf(tmp, sizeof(tmp), "%.3d", millisecs);
86+
snprintf(tbuf, ltbuf, "%s.%.3s %s", timestamp_date_time, tmp, timestamp_timezone);
8487
}
8588

8689
/* Get basename of filename */

0 commit comments

Comments
 (0)