GenericTLVPacketParser: fix for 64bit
[senf.git] / Utils / Console / Server.cc
index d326133..cbc8aca 100644 (file)
@@ -27,6 +27,7 @@
 #include "Server.ih"
 
 // Custom includes
+#include <errno.h>
 #include <iostream>
 #include <boost/algorithm/string/trim.hpp>
 #include <boost/iostreams/device/file_descriptor.hpp>
@@ -93,7 +94,8 @@ prefix_ senf::console::Server::Server(ServerHandle handle)
     : handle_ (handle), 
       event_ ("senf::console::Server", senf::membind(&Server::newClient, this),
               handle_, scheduler::FdEvent::EV_READ),
-      root_ (senf::console::root().thisptr()), mode_ (Automatic)
+      root_ (senf::console::root().thisptr()), mode_ (Automatic),
+      name_ (::program_invocation_short_name)
 {}
 
 prefix_ void senf::console::Server::newClient(int event)
@@ -291,7 +293,11 @@ prefix_ std::string::size_type senf::console::Client::handleInput(std::string da
         handle_.facet<senf::TCPSocketProtocol>().shutdown(senf::TCPSocketProtocol::ShutRD);
     }
     catch (std::exception & ex) {
-        stream() << ex.what() << std::endl;
+        std::string msg (ex.what());
+        std::string::size_type i (msg.find("-- \n"));
+        if (i != std::string::npos)
+            msg = msg.substr(i+4);
+        stream() << msg << std::endl;
     }
     catch (...) {
         stream() << "unidentified error (unknown exception thrown)" << std::endl;