mirror of
https://github.com/transmission/transmission
synced 2025-02-03 04:53:27 +00:00
(trunk libT) add some testing messages for #2030... this dumps a lot of junk to the terminal and will be taken out as soon as there's some meaningful feedback in #2030
This commit is contained in:
parent
c1a8c7363a
commit
7fcf0a294b
1 changed files with 8 additions and 1 deletions
|
@ -469,6 +469,7 @@ tr_loadFile( const char * path,
|
||||||
uint8_t * buf;
|
uint8_t * buf;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
int fd;
|
int fd;
|
||||||
|
ssize_t n;
|
||||||
const char * err_fmt = _( "Couldn't read \"%1$s\": %2$s" );
|
const char * err_fmt = _( "Couldn't read \"%1$s\": %2$s" );
|
||||||
|
|
||||||
/* try to stat the file */
|
/* try to stat the file */
|
||||||
|
@ -480,6 +481,7 @@ tr_loadFile( const char * path,
|
||||||
errno = err;
|
errno = err;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
tr_inf( "at the end of stat(%s), errno is %d", path, errno );
|
||||||
|
|
||||||
if( ( sb.st_mode & S_IFMT ) != S_IFREG )
|
if( ( sb.st_mode & S_IFMT ) != S_IFREG )
|
||||||
{
|
{
|
||||||
|
@ -487,6 +489,7 @@ tr_loadFile( const char * path,
|
||||||
errno = EISDIR;
|
errno = EISDIR;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
tr_inf( "looks like %s is a regular file... now we'll try to read it", path );
|
||||||
|
|
||||||
/* Load the torrent file into our buffer */
|
/* Load the torrent file into our buffer */
|
||||||
fd = tr_open_file_for_scanning( path );
|
fd = tr_open_file_for_scanning( path );
|
||||||
|
@ -497,6 +500,7 @@ tr_loadFile( const char * path,
|
||||||
errno = err;
|
errno = err;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
tr_inf( "after trying to open the file for reading, fd is %d and errno is %d", fd, errno );
|
||||||
buf = malloc( sb.st_size + 1 );
|
buf = malloc( sb.st_size + 1 );
|
||||||
if( !buf )
|
if( !buf )
|
||||||
{
|
{
|
||||||
|
@ -506,7 +510,9 @@ tr_loadFile( const char * path,
|
||||||
errno = err;
|
errno = err;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if( read( fd, buf, sb.st_size ) != sb.st_size )
|
n = read( fd, buf, sb.st_size );
|
||||||
|
tr_inf( "file size is %"PRId64"; read is %"PRId64", errno is %d", (int64_t)sb.st_size, (int64_t)n, errno );
|
||||||
|
if( n == -1 )
|
||||||
{
|
{
|
||||||
const int err = errno;
|
const int err = errno;
|
||||||
tr_err( err_fmt, path, tr_strerror( errno ) );
|
tr_err( err_fmt, path, tr_strerror( errno ) );
|
||||||
|
@ -516,6 +522,7 @@ tr_loadFile( const char * path,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr_inf( "nearing the end, and errno is %d", errno );
|
||||||
tr_close_file( fd );
|
tr_close_file( fd );
|
||||||
buf[ sb.st_size ] = '\0';
|
buf[ sb.st_size ] = '\0';
|
||||||
*size = sb.st_size;
|
*size = sb.st_size;
|
||||||
|
|
Loading…
Reference in a new issue