1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-19 10:15:36 +00:00

(trunk libt) #3004 "Transmission doesn't report to the user errors when saving settings files" -- committed Longinus00's patch to trunk for 2.00

This commit is contained in:
Charles Kerr 2010-03-22 00:55:43 +00:00
parent 157707f93e
commit 83f97a35fe
3 changed files with 10 additions and 5 deletions

View file

@ -500,10 +500,12 @@ loadProgress( tr_benc * dict,
***/ ***/
void void
tr_torrentSaveResume( const tr_torrent * tor ) tr_torrentSaveResume( tr_torrent * tor )
{ {
int err;
tr_benc top; tr_benc top;
char * filename; char * filename;
if( !tr_isTorrent( tor ) ) if( !tr_isTorrent( tor ) )
return; return;
@ -534,7 +536,8 @@ tr_torrentSaveResume( const tr_torrent * tor )
saveRatioLimits( &top, tor ); saveRatioLimits( &top, tor );
filename = getResumeFilename( tor ); filename = getResumeFilename( tor );
tr_bencToFile( &top, TR_FMT_BENC, filename ); if(( err = tr_bencToFile( &top, TR_FMT_BENC, filename )))
tr_torrentSetLocalError( tor, "Unable to save resume file: %s", tr_strerror( err ) );
tr_free( filename ); tr_free( filename );
tr_bencFree( &top ); tr_bencFree( &top );

View file

@ -45,7 +45,7 @@ uint64_t tr_torrentLoadResume( tr_torrent * tor,
uint64_t fieldsToLoad, uint64_t fieldsToLoad,
const tr_ctor * ctor ); const tr_ctor * ctor );
void tr_torrentSaveResume( const tr_torrent * tor ); void tr_torrentSaveResume( tr_torrent * tor );
void tr_torrentRemoveResume( const tr_torrent * tor ); void tr_torrentRemoveResume( const tr_torrent * tor );

View file

@ -696,7 +696,9 @@ torrentInit( tr_torrent * tor, const tr_ctor * ctor )
if( !tr_ctorGetMetainfo( ctor, &val ) ) if( !tr_ctorGetMetainfo( ctor, &val ) )
{ {
const char * path = tor->info.torrent; const char * path = tor->info.torrent;
tr_bencToFile( val, TR_FMT_BENC, path ); const int err = tr_bencToFile( val, TR_FMT_BENC, path );
if( err )
tr_torrentSetLocalError( tor, "Unable to save torrent file: %s", tr_strerror( err ) );
tr_sessionSetTorrentFile( tor->session, tor->info.hashString, path ); tr_sessionSetTorrentFile( tor->session, tor->info.hashString, path );
} }
} }