From 865d9d7a349b57a533b8bfdaea453c8a87b1af85 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 29 Sep 2010 02:38:14 +0000 Subject: [PATCH] (trukn libT) call tr_close_file() instead of close() after saving a benc file to disk --- libtransmission/bencode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libtransmission/bencode.c b/libtransmission/bencode.c index 1c84131d2..c9071da9f 100644 --- a/libtransmission/bencode.c +++ b/libtransmission/bencode.c @@ -27,7 +27,7 @@ #include /* stat() */ #include /* stat() */ #include -#include /* stat(), close() */ +#include /* stat() */ #include /* struct evbuffer */ @@ -35,6 +35,7 @@ #include "transmission.h" #include "bencode.h" +#include "fdlimit.h" /* tr_close_file() */ #include "json.h" #include "list.h" #include "platform.h" /* TR_PATH_MAX */ @@ -1682,7 +1683,7 @@ tr_bencToFile( const tr_benc * top, tr_fmt_mode mode, const char * filename ) if( write( fd, str, len ) == (ssize_t)len ) { tr_fsync( fd ); - close( fd ); + tr_close_file( fd ); if( !unlink( filename ) || ( errno == ENOENT ) ) { @@ -1710,7 +1711,7 @@ tr_bencToFile( const tr_benc * top, tr_fmt_mode mode, const char * filename ) { err = errno; tr_err( _( "Couldn't save temporary file \"%1$s\": %2$s" ), tmp, tr_strerror( err ) ); - close( fd ); + tr_close_file( fd ); unlink( tmp ); }