diff --git a/libtransmission/utils.c b/libtransmission/utils.c index 451046c75..2e42784bd 100644 --- a/libtransmission/utils.c +++ b/libtransmission/utils.c @@ -332,12 +332,17 @@ tr_msg( const char * file, } else { + char timestr[64]; + if( fp == NULL ) fp = stderr; + + tr_getLogTimeStr( timestr, sizeof( timestr ) ); + if( name ) - fprintf( fp, "%s: %s\n", name, buf ); + fprintf( fp, "[%s] %s: %s\n", timestr, name, buf ); else - fprintf( fp, "%s\n", buf ); + fprintf( fp, "[%s] %s\n", timestr, buf ); fflush( fp ); } } @@ -1403,7 +1408,7 @@ parseNumberSection( const char * str, int len, struct number_range * setme ) char * tmp = tr_strndup( str, len ); errno = 0; - a = strtol( tmp, &end, 10 ); + a = b = strtol( tmp, &end, 10 ); if( errno || ( end == tmp ) ) { success = FALSE; } else if( *end != '-' ) {