Changeset 2071

Show
Ignore:
Timestamp:
02/01/2008 03:27:51 PM (7 months ago)
Author:
jan
Message:

fixed log_write() for log-files > 4kbyte

the buffer_prepare_append() works against a "used" buffer, but ->used
get's never updated. With older glibc's which leads to a infinite loop

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/NEWS

    r2064 r2071  
    1717  * mod_auth ldap rework, most important change is being able to startup if ldap server is down (#1535) 
    1818  * fixed ECONNRESET handling in network-openssl 
     19  * fixed log_write() for log-files > 4kbyte 
    1920 
    2021- 1.5.0-r19.. - 
  • trunk/src/log.c

    r2048 r2071  
    322322                va_end(ap); 
    323323 
     324                /* if 'l' is between -1 and size we are good, 
     325                 * otherwise we have to resize to size  
     326                 */ 
     327 
    324328                if (l > -1 && ((unsigned int) l) < b->size) { 
    325329                        b->used = l + 1; 
     
    329333 
    330334                if (l > -1) { 
    331                         /* l is the mem-size we need */ 
     335                        /* C99: l is the mem-size we need */ 
    332336                        buffer_prepare_copy(b, l); 
    333337                } else { 
    334                         /* try to get some more bytes and try again */ 
    335                         buffer_prepare_append(b, 512); 
     338                        /* glibc 2.0.x and earlier return -1 */ 
     339                        buffer_prepare_copy(b, b->size + 512); 
    336340                } 
    337341        } while(1);