(trunk libT) in tr_bencToFile(), call fsync() before close() for better ext4 safety

This commit is contained in:
Charles Kerr 2010-03-09 22:59:14 +00:00
parent 7a129d9cf9
commit 539f0edaba
1 changed files with 1 additions and 0 deletions

View File

@ -1633,6 +1633,7 @@ tr_bencToFile( const tr_benc * top, tr_fmt_mode mode, const char * filename )
if( write( fd, str, len ) == (ssize_t)len )
{
fsync( fd );
close( fd );
if( !unlink( filename ) || ( errno == ENOENT ) )