From: Charles Kerr Date: Sat, 5 Apr 2008 16:45:35 +0000 (+0000) Subject: don't flood the message log when you don't have a blocklist X-Git-Tag: 1.20~266 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6d52fa685693a98d7a8833d29225d3658c2371f3;p=transmission don't flood the message log when you don't have a blocklist --- diff --git a/libtransmission/blocklist.c b/libtransmission/blocklist.c index 5dc74a548..07664e071 100644 --- a/libtransmission/blocklist.c +++ b/libtransmission/blocklist.c @@ -70,16 +70,15 @@ blocklistLoad( tr_blocklist * b ) blocklistClose( b ); + if( stat( b->filename, &st ) == -1 ) + return; + fd = open( b->filename, O_RDONLY ); if( fd == -1 ) { tr_err( err_fmt, b->filename, tr_strerror(errno) ); return; } - if( fstat( fd, &st ) == -1 ) { - tr_err( err_fmt, b->filename, tr_strerror(errno) ); - close( fd ); - return; - } + b->rules = mmap( 0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0 ); if( !b->rules ) { tr_err( err_fmt, b->filename, tr_strerror(errno) );