(trunk libT) when we can't bind to a port and the error is EADDRINUSE, add a parenthetical hint "(Is another copy of Transmission already running?)"

This commit is contained in:
Charles Kerr 2010-02-06 14:43:28 +00:00
parent 0f1c496119
commit 5a69330344
1 changed files with 16 additions and 2 deletions

View File

@ -352,8 +352,22 @@ tr_netBindTCPImpl( const tr_address * addr, tr_port port, tr_bool suppressMsgs,
if( bind( fd, (struct sockaddr *) &sock, addrlen ) ) {
const int err = sockerrno;
if( !suppressMsgs )
tr_err( _( "Couldn't bind port %d on %s: %s" ),
port, tr_ntop_non_ts( addr ), tr_strerror( err ) );
{
const char * fmt;
const char * hint;
if( err == EADDRINUSE )
hint = _( "Is another copy of Transmission already running?" );
else
hint = NULL;
if( hint == NULL )
fmt = _( "Couldn't bind port %d on %s: %s" );
else
fmt = _( "Couldn't bind port %d on %s: %s (%s)" );
tr_err( fmt, port, tr_ntop_non_ts( addr ), tr_strerror( err ), hint );
}
tr_netCloseSocket( fd );
*errOut = err;
return -1;