(trunk libT) in tr_bencToFile(), call fsync() before close() for better ext4 safety
This commit is contained in:
parent
7a129d9cf9
commit
539f0edaba
|
@ -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 )
|
if( write( fd, str, len ) == (ssize_t)len )
|
||||||
{
|
{
|
||||||
|
fsync( fd );
|
||||||
close( fd );
|
close( fd );
|
||||||
|
|
||||||
if( !unlink( filename ) || ( errno == ENOENT ) )
|
if( !unlink( filename ) || ( errno == ENOENT ) )
|
||||||
|
|
Loading…
Reference in New Issue