(trunk libT) don't rely just on errno to tell if tr_loadFile() succeeded. xref: http://trac.transmissionbt.com/ticket/2030?replyto=38#comment:38

This commit is contained in:
Charles Kerr 2009-05-08 17:04:12 +00:00
parent 0d5cb0fa5a
commit 827c7829aa
1 changed files with 7 additions and 7 deletions

View File

@ -335,13 +335,7 @@ serve_file( struct evhttp_request * req,
content_len = 0;
content = tr_loadFile( filename, &content_len );
if( errno )
{
char * tmp = tr_strdup_printf( "%s (%s)", filename, tr_strerror( errno ) );
send_simple_response( req, HTTP_NOTFOUND, tmp );
tr_free( tmp );
}
else
if( content )
{
struct evbuffer * out;
const time_t now = time( NULL );
@ -357,6 +351,12 @@ serve_file( struct evhttp_request * req,
tr_releaseBuffer( out );
tr_free( content );
}
else
{
char * tmp = tr_strdup_printf( "%s (%s)", filename, tr_strerror( errno ) );
send_simple_response( req, HTTP_NOTFOUND, tmp );
tr_free( tmp );
}
}
}