1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 16:52:39 +00:00

replace the unhelpful error message "error: insufficient resources" with more descriptive cases

This commit is contained in:
Charles Kerr 2007-07-01 01:50:14 +00:00
parent 9dfdad87ec
commit 58f89cdc77
3 changed files with 19 additions and 11 deletions

View file

@ -799,9 +799,13 @@ ipc_addstat( benc_val_t * list, int tor,
{ {
tr_bencInitStr( item, "io-space", -1, 1 ); tr_bencInitStr( item, "io-space", -1, 1 );
} }
else if( TR_ERROR_ISSET( TR_ERROR_IO_RESOURCES, error ) ) else if( TR_ERROR_ISSET( TR_ERROR_IO_FILE_TOO_BIG, error ) )
{ {
tr_bencInitStr( item, "io-resources", -1, 1 ); tr_bencInitStr( item, "io-file-too-big", -1, 1 );
}
else if( TR_ERROR_ISSET( TR_ERROR_IO_OPEN_FILES, error ) )
{
tr_bencInitStr( item, "io-open-files", -1, 1 );
} }
else if( TR_ERROR_ISSET( TR_ERROR_IO_MASK, error ) ) else if( TR_ERROR_ISSET( TR_ERROR_IO_MASK, error ) )
{ {

View file

@ -77,12 +77,13 @@ extern "C" {
#define TR_ERROR_ASSERT 0x82000000 #define TR_ERROR_ASSERT 0x82000000
/* I/O errors */ /* I/O errors */
#define TR_ERROR_IO_MASK 0x000000FF #define TR_ERROR_IO_MASK 0x000000FF
#define TR_ERROR_IO_PARENT 0x80000001 #define TR_ERROR_IO_PARENT ((1<<31) | (1<<0))
#define TR_ERROR_IO_PERMISSIONS 0x80000002 #define TR_ERROR_IO_PERMISSIONS ((1<<31) | (1<<1))
#define TR_ERROR_IO_SPACE 0x80000004 #define TR_ERROR_IO_SPACE ((1<<31) | (1<<2))
#define TR_ERROR_IO_RESOURCES 0x80000008 #define TR_ERROR_IO_FILE_TOO_BIG ((1<<31) | (1<<3))
#define TR_ERROR_IO_DUP_DOWNLOAD 0x8000000A #define TR_ERROR_IO_OPEN_FILES ((1<<31) | (1<<4))
#define TR_ERROR_IO_OTHER 0x80000010 #define TR_ERROR_IO_DUP_DOWNLOAD ((1<<31) | (1<<5))
#define TR_ERROR_IO_OTHER ((1<<31) | (1<<6))
/* Misc */ /* Misc */
#define TR_ERROR_TC_MASK 0x00000F00 #define TR_ERROR_TC_MASK 0x00000F00
#define TR_ERROR_TC_ERROR 0x80000100 #define TR_ERROR_TC_ERROR 0x80000100

View file

@ -342,8 +342,9 @@ tr_ioErrorFromErrno( void )
case ENOSPC: case ENOSPC:
return TR_ERROR_IO_SPACE; return TR_ERROR_IO_SPACE;
case EMFILE: case EMFILE:
return TR_ERROR_IO_FILE_TOO_BIG;
case EFBIG: case EFBIG:
return TR_ERROR_IO_RESOURCES; return TR_ERROR_IO_OPEN_FILES;
default: default:
tr_dbg( "generic i/o errno from errno: %s", strerror( errno ) ); tr_dbg( "generic i/o errno from errno: %s", strerror( errno ) );
return TR_ERROR_IO_OTHER; return TR_ERROR_IO_OTHER;
@ -369,8 +370,10 @@ tr_errorString( int code )
return "Insufficient free space"; return "Insufficient free space";
case TR_ERROR_IO_DUP_DOWNLOAD: case TR_ERROR_IO_DUP_DOWNLOAD:
return "Already active transfer with same name and download folder"; return "Already active transfer with same name and download folder";
case TR_ERROR_IO_RESOURCES: case TR_ERROR_IO_FILE_TOO_BIG:
return "Insufficient resources"; return "File too large";
case TR_ERROR_IO_OPEN_FILES:
return "Too many open files";
case TR_ERROR_IO_OTHER: case TR_ERROR_IO_OTHER:
return "Generic I/O error"; return "Generic I/O error";
} }