mirror of
https://github.com/transmission/transmission
synced 2025-02-03 13:03:50 +00:00
(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:
parent
0d5cb0fa5a
commit
827c7829aa
1 changed files with 7 additions and 7 deletions
|
@ -335,13 +335,7 @@ serve_file( struct evhttp_request * req,
|
||||||
content_len = 0;
|
content_len = 0;
|
||||||
content = tr_loadFile( filename, &content_len );
|
content = tr_loadFile( filename, &content_len );
|
||||||
|
|
||||||
if( errno )
|
if( content )
|
||||||
{
|
|
||||||
char * tmp = tr_strdup_printf( "%s (%s)", filename, tr_strerror( errno ) );
|
|
||||||
send_simple_response( req, HTTP_NOTFOUND, tmp );
|
|
||||||
tr_free( tmp );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
struct evbuffer * out;
|
struct evbuffer * out;
|
||||||
const time_t now = time( NULL );
|
const time_t now = time( NULL );
|
||||||
|
@ -357,6 +351,12 @@ serve_file( struct evhttp_request * req,
|
||||||
tr_releaseBuffer( out );
|
tr_releaseBuffer( out );
|
||||||
tr_free( content );
|
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 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue