]> granicus.if.org Git - transmission/commitdiff
(trunk libT) when we can't bind to a port and the error is EADDRINUSE, add a parenthe...
authorCharles Kerr <charles@transmissionbt.com>
Sat, 6 Feb 2010 14:43:28 +0000 (14:43 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Sat, 6 Feb 2010 14:43:28 +0000 (14:43 +0000)
libtransmission/net.c

index 1a0652d54038ca4ad32c61b6fa986d05dccdd31f..678c6220f6983e6848753fee0f5bc29ad81f3c6a 100644 (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;