From 767aa82685f80d4e1652f7f8eeaa0734ccf8f2f2 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 31 Oct 2011 21:09:45 +0000 Subject: Improve error message on bbackupd command socket bind failure, thanks to Christophe. --- lib/server/ServerException.txt | 2 +- lib/server/SocketListen.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/server/ServerException.txt b/lib/server/ServerException.txt index ed591b73..474b4067 100644 --- a/lib/server/ServerException.txt +++ b/lib/server/ServerException.txt @@ -13,7 +13,7 @@ SocketOpenError 10 SocketPollError 11 SocketCloseError 13 SocketNameUNIXPathTooLong 14 -SocketBindError 16 Check the ListenAddresses directive in your config file -- must refer to local IP addresses only +SocketBindError 16 Check the ListenAddresses directive (bbstored) or CommandSocket (bbackupd) in your config file -- must refer to local IP addresses (or existing writable path) only SocketAcceptError 17 ServerStreamBadListenAddrs 18 ServerForkError 19 diff --git a/lib/server/SocketListen.h b/lib/server/SocketListen.h index 1ec6f512..170c56a1 100644 --- a/lib/server/SocketListen.h +++ b/lib/server/SocketListen.h @@ -166,10 +166,13 @@ public: if(::bind(mSocketHandle, &addr.sa_generic, addrLen) == -1 || ::listen(mSocketHandle, ListenBacklog) == -1) { + int err_number = errno; // Dispose of the socket ::close(mSocketHandle); mSocketHandle = -1; - THROW_EXCEPTION(ServerException, SocketBindError) + THROW_SYS_FILE_ERRNO("Failed to bind or listen " + "on socket", Name, err_number, + ServerException, SocketBindError); } } -- cgit v1.2.3