8062370: Various minor code improvements

A lot of fixes useful to improve the code quality.

Reviewed-by: coleenp, dholmes
This commit is contained in:
Goetz Lindenmaier 2014-10-29 10:13:24 +01:00
parent f048251de8
commit 0aa09022fa
35 changed files with 141 additions and 64 deletions

View file

@ -2583,7 +2583,14 @@ ATTRIBUTE_PRINTF(3, 0)
int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args) {
// see bug 4399518, 4417214
if ((intptr_t)count <= 0) return -1;
return vsnprintf(str, count, fmt, args);
int result = vsnprintf(str, count, fmt, args);
if ((result > 0 && (size_t)result >= count) || result == -1) {
str[count - 1] = '\0';
result = -1;
}
return result;
}
ATTRIBUTE_PRINTF(3, 0)