summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-04-02 18:54:06 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2019-04-02 18:54:06 +0100
commit3a4193a743904cc9526f71b6d9015905566cc5f7 (patch)
tree94c849ae7ae55a4120d7bb859f6014634b9aecb7
parentTest configs are runtime, not build time deps (diff)
downloadnetfs-3a4193a743904cc9526f71b6d9015905566cc5f7.tar.bz2
netfs-3a4193a743904cc9526f71b6d9015905566cc5f7.tar.xz
netfs-3a4193a743904cc9526f71b6d9015905566cc5f7.zip
Fix hostname lookupnetfs-1.3.3.1
-rw-r--r--netfs/daemon/daemon.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/netfs/daemon/daemon.cpp b/netfs/daemon/daemon.cpp
index a773716..ddd67f2 100644
--- a/netfs/daemon/daemon.cpp
+++ b/netfs/daemon/daemon.cpp
@@ -21,7 +21,10 @@ NetFSDaemon::hostname()
auto hostNameOverride = props->getProperty("NetFSD.HostNameOverride");
if (hostNameOverride.empty()) {
std::string buf(128, 0);
- gethostname(buf.data(), buf.size());
+ if (gethostname(buf.data(), buf.size())) {
+ throw NetFS::Daemon::HostNotConfigured(strerror(errno));
+ }
+ buf.resize(strlen(buf.data()));
return buf;
}
return hostNameOverride;