(trunk, libt) #4147 'bad file descriptor': in cached_file_open(), ensure the file is always opened with writable permissions if we need to call ftruncate() to resize it. Large credit to karamanolev for tracking this down with strace.

git-svn-id: svn://svn.transmissionbt.com/Transmission/trunk@14147 f4695dd4-2c0a-0410-b89c-da849a56a58e