aboutsummaryrefslogtreecommitdiff
path: root/apps/apps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'apps/apps.cpp')
-rw-r--r--apps/apps.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/apps.cpp b/apps/apps.cpp
index 783c0b0..e0bb631 100644
--- a/apps/apps.cpp
+++ b/apps/apps.cpp
@@ -9,6 +9,12 @@ using namespace std;
namespace po = boost::program_options;
std::string get_hostname() {
+ static string s = "";
+
+ if (!s.empty()) {
+ return s;
+ }
+
struct addrinfo hints, *info, *p;
// int gai_result;
@@ -25,10 +31,8 @@ std::string get_hostname() {
return "uknown";
}
- string s = "unknown";
-
if (info) {
- s = string(info->ai_canonname);
+ s = info->ai_canonname;
}
freeaddrinfo(info);