src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp

changeset 9478
f3108e56b502
parent 9327
f96fcd9e1e1b
child 9572
624a0741915c
child 9858
b985cbb00e68
     1.1 --- a/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Wed Aug 01 04:19:22 2018 -0400
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Thu Aug 02 03:54:51 2018 -0700
     1.3 @@ -41,13 +41,13 @@
     1.4    int _cur;
     1.5  
     1.6    void vappend(const char* format, va_list ap)  ATTRIBUTE_PRINTF(2, 0) {
     1.7 -    int res = vsnprintf(&_buffer[_cur], BUFFER_LEN - _cur, format, ap);
     1.8 -    if (res != -1) {
     1.9 -      _cur += res;
    1.10 -    } else {
    1.11 +    int res = os::vsnprintf(&_buffer[_cur], BUFFER_LEN - _cur, format, ap);
    1.12 +    if (res > BUFFER_LEN) {
    1.13        DEBUG_ONLY(warning("buffer too small in LineBuffer");)
    1.14        _buffer[BUFFER_LEN -1] = 0;
    1.15        _cur = BUFFER_LEN; // vsnprintf above should not add to _buffer if we are called again
    1.16 +    } else if (res != -1) {
    1.17 +      _cur += res;
    1.18      }
    1.19    }
    1.20  

mercurial