fix permissions issue reported by Jaybird in http://transmission.m0k.org/forum/viewtopic.php?t=2944

This commit is contained in:
Charles Kerr 2007-11-17 16:20:08 +00:00
parent d140cd0af6
commit a2609ae2a7
1 changed files with 9 additions and 5 deletions

View File

@ -86,11 +86,15 @@ myDebug( const char * file, int line, const char * fmt, ... )
enum
{
TR_MAX_SOCKETS = 512,
TR_MAX_SOCKETS = 320,
TR_MAX_OPEN_FILES = 16, /* real files, not sockets */
TR_MAX_OPEN_FILES = 8, /* real files, not sockets */
TR_RESERVED_FDS = 16 /* sockets reserved for tracker connections */
TR_RESERVED_FDS = 16, /* sockets reserved for tracker connections */
TR_MKDIR_PERM = 0777,
TR_CREAT_PERM = 0666
};
struct tr_openfile
@ -131,7 +135,7 @@ TrOpenFile( int i, const char * filename, int write )
/* create subfolders, if any */
if( write ) {
char * tmp = tr_strdup( filename );
const int val = tr_mkdirp( dirname(tmp), 0700 );
const int val = tr_mkdirp( dirname(tmp), TR_MKDIR_PERM );
tr_free( tmp );
if( val )
return tr_ioErrorFromErrno( );
@ -146,7 +150,7 @@ TrOpenFile( int i, const char * filename, int write )
flags |= O_BINARY;
#endif
errno = 0;
file->fd = open( filename, flags, 0600 );
file->fd = open( filename, flags, TR_CREAT_PERM );
if( file->fd < 0 ) {
if( errno ) {
tr_err( "Couldn't open '%s': %s", filename, strerror(errno) );