mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
(trunk libt) #4305 "New Torrent via RPC Error:No data found when subfolder does not exist" -- revert r12076 s.t. parent directories are created as necessary when saving local data to disk.
This commit is contained in:
parent
feb4ddadd5
commit
434a988165
3 changed files with 3 additions and 19 deletions
|
@ -342,7 +342,6 @@ cached_file_close( struct tr_cached_file * o )
|
|||
*/
|
||||
static int
|
||||
cached_file_open( struct tr_cached_file * o,
|
||||
const char * existing_dir,
|
||||
const char * filename,
|
||||
bool writable,
|
||||
tr_preallocation_mode allocation,
|
||||
|
@ -352,14 +351,6 @@ cached_file_open( struct tr_cached_file * o,
|
|||
struct stat sb;
|
||||
bool alreadyExisted;
|
||||
|
||||
/* confirm that existing_dir, if specified, exists on the disk */
|
||||
if( existing_dir && *existing_dir && stat( existing_dir, &sb ) )
|
||||
{
|
||||
const int err = errno;
|
||||
tr_err( _( "Couldn't open \"%1$s\": %2$s" ), existing_dir, tr_strerror( err ) );
|
||||
return err;
|
||||
}
|
||||
|
||||
/* create subfolders, if any */
|
||||
if( writable )
|
||||
{
|
||||
|
@ -631,7 +622,6 @@ int
|
|||
tr_fdFileCheckout( tr_session * session,
|
||||
int torrent_id,
|
||||
tr_file_index_t i,
|
||||
const char * existing_dir,
|
||||
const char * filename,
|
||||
bool writable,
|
||||
tr_preallocation_mode allocation,
|
||||
|
@ -647,7 +637,7 @@ tr_fdFileCheckout( tr_session * session,
|
|||
|
||||
if( !cached_file_is_open( o ) )
|
||||
{
|
||||
const int err = cached_file_open( o, existing_dir, filename, writable, allocation, file_size );
|
||||
const int err = cached_file_open( o, filename, writable, allocation, file_size );
|
||||
if( err ) {
|
||||
errno = err;
|
||||
return -1;
|
||||
|
|
|
@ -51,11 +51,6 @@ int tr_prefetch(int fd, off_t offset, size_t count);
|
|||
* - if do_write is true, subfolders in torrentFile are created if necessary.
|
||||
* - if do_write is true, the target file is created if necessary.
|
||||
*
|
||||
* @param existing_dir An ancestor of filename which must already exist and
|
||||
* won't be created by tr_fdFileCheckout(). This prevents
|
||||
* directories from being created in error, such as a mount
|
||||
* point for an external drive when the drive is unplugged.
|
||||
*
|
||||
* on success, a file descriptor >= 0 is returned.
|
||||
* on failure, a -1 is returned and errno is set.
|
||||
*
|
||||
|
@ -64,7 +59,6 @@ int tr_prefetch(int fd, off_t offset, size_t count);
|
|||
int tr_fdFileCheckout( tr_session * session,
|
||||
int torrent_id,
|
||||
tr_file_index_t file_num,
|
||||
const char * existing_dir,
|
||||
const char * filename,
|
||||
bool do_write,
|
||||
tr_preallocation_mode preallocation_mode,
|
||||
|
|
|
@ -92,7 +92,7 @@ readOrWriteBytes( tr_session * session,
|
|||
? TR_PREALLOCATE_NONE
|
||||
: tor->session->preallocationMode;
|
||||
if((( fd = tr_fdFileCheckout( session, tor->uniqueId, fileIndex,
|
||||
base, filename, doWrite,
|
||||
filename, doWrite,
|
||||
prealloc, file->length ))) < 0 )
|
||||
{
|
||||
err = errno;
|
||||
|
|
Loading…
Reference in a new issue