From 434a988165156e4f4757559f178c2172461b0c56 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Mon, 25 Jul 2011 17:48:14 +0000 Subject: [PATCH] (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. --- libtransmission/fdlimit.c | 12 +----------- libtransmission/fdlimit.h | 8 +------- libtransmission/inout.c | 2 +- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/libtransmission/fdlimit.c b/libtransmission/fdlimit.c index 35397310e..406056fc5 100644 --- a/libtransmission/fdlimit.c +++ b/libtransmission/fdlimit.c @@ -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; diff --git a/libtransmission/fdlimit.h b/libtransmission/fdlimit.h index 03874f8f0..0b01190e2 100644 --- a/libtransmission/fdlimit.h +++ b/libtransmission/fdlimit.h @@ -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,9 +59,8 @@ 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, + bool do_write, tr_preallocation_mode preallocation_mode, uint64_t preallocation_file_size ); diff --git a/libtransmission/inout.c b/libtransmission/inout.c index f35f0845b..ab51d2089 100644 --- a/libtransmission/inout.c +++ b/libtransmission/inout.c @@ -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;