mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +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:
parent
0f1c496119
commit
5a69330344
1 changed files with 16 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue