1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

(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

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;