Ignore:
Timestamp:
Apr 20, 2007, 2:05:07 AM (15 years ago)
Author:
joshe
Message:

Add more I/O error codes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r1441 r1763  
    6868 * Local prototypes
    6969 **********************************************************************/
    70 static int  ErrorFromErrno();
    7170static int  OpenFile( int i, char * folder, char * name, int write );
    7271static void CloseFile( int i );
     
    408407
    409408/***********************************************************************
    410  * ErrorFromErrno
    411  **********************************************************************/
    412 static int ErrorFromErrno()
    413 {
    414     if( errno == EACCES || errno == EROFS )
    415         return TR_ERROR_IO_PERMISSIONS;
    416     return TR_ERROR_IO_OTHER;
    417 }
    418 
    419 /***********************************************************************
    420409 * CheckFolder
    421410 ***********************************************************************
     
    427416    struct stat sb;
    428417    char * path;
     418    int ret;
    429419
    430420    tr_dbg( "Opening %s in %s (%d)", name, folder, write );
     
    451441                if( mkdir( path, 0777 ) )
    452442                {
     443                    ret = tr_ioErrorFromErrno();
    453444                    tr_err( "Could not create folder '%s'", path );
    454445                    free( path );
    455                     return ErrorFromErrno();
     446                    return ret;
    456447                }
    457448            }
     
    472463    /* Now try to really open the file */
    473464    file->file = open( path, write ? ( O_RDWR | O_CREAT ) : O_RDONLY, 0666 );
    474     free( path );
    475 
    476465    if( file->file < 0 )
    477466    {
    478         int ret = ErrorFromErrno();
     467        ret = tr_ioErrorFromErrno();
     468        free( path );
    479469        tr_err( "Could not open %s in %s (%d, %d)", name, folder, write, ret );
    480470        return ret;
    481471    }
     472    free( path );
    482473
    483474    return TR_OK;
Note: See TracChangeset for help on using the changeset viewer.