From dc84cdd5384523ccf6ff00bb227d174965ed9289 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 17 Dec 2016 05:46:04 +0000 Subject: [PATCH] Add more diagnostic information when failing to bind/listen to socket --- src/remote.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/remote.cc b/src/remote.cc index c4d0cec0..4a2cfc3c 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -723,10 +723,12 @@ Server::Server(String session_name) auto restore_mask = on_scope_end([old_mask]() { umask(old_mask); }); if (bind(listen_sock, (sockaddr*) &addr, sizeof(sockaddr_un)) == -1) - throw runtime_error(format("unable to bind listen socket '{}'", addr.sun_path)); + throw runtime_error(format("unable to bind listen socket '{}': {}", + addr.sun_path, strerror(errno))); if (listen(listen_sock, 4) == -1) - throw runtime_error(format("unable to listen on socket '{}'", addr.sun_path)); + throw runtime_error(format("unable to listen on socket '{}': {}", + addr.sun_path, strerror(errno))); auto accepter = [this](FDWatcher& watcher, FdEvents, EventMode mode) { sockaddr_un client_addr;