Commit 07f4c0be authored by Benoît Dejean's avatar Benoît Dejean Committed by Benoît Dejean
Browse files

Displays `uname -n` instead of FQDN. Code about handling FQDN was getting

2007-04-10  Benoît Dejean  <benoit@placenet.org>

	* src/sysinfo.cpp:

	Displays `uname -n` instead of FQDN.
	Code about handling FQDN was getting bigger and bigger
	because of broken /etc/hosts.
	Closes #427796.

svn path=/trunk/; revision=1995
parent a11e9567
2007-04-10 Benoît Dejean <benoit@placenet.org>
* src/sysinfo.cpp:
Displays `uname -n` instead of FQDN.
Code about handling FQDN was getting bigger and bigger
because of broken /etc/hosts.
Closes #427796.
2007-04-08 Benoît Dejean <benoit@placenet.org>
* src/disks.cpp:
......
......@@ -49,7 +49,6 @@ namespace {
SysInfo()
{
this->load_hostname();
this->load_processors_info();
this->load_memory_info();
this->load_disk_info();
......@@ -61,37 +60,6 @@ namespace {
private:
void load_hostname()
{
char buf[256];
if (gethostname(buf, sizeof buf) == -1) {
g_warning("gethostname failed : %s", strerror(errno));
return;
}
struct hostent *h;
if (not (h = gethostbyname(buf))) {
g_warning("gethostbyname failed : %s", strerror(errno));
return;
}
this->hostname = h->h_name;
if (this->hostname.find("localhost") == 0) {
for (char **p = h->h_aliases; *p != NULL; ++p) {
const string alias(*p);
if (alias.find("localhost") == 0)
continue;
if (this->hostname.find("localhost") == 0
or alias.size() > this->hostname.size())
this->hostname = alias;
}
}
}
void load_memory_info()
{
glibtop_mem mem;
......@@ -154,6 +122,7 @@ namespace {
uname(&name);
this->hostname = name.nodename;
this->distro_name = name.sysname;
this->distro_release = name.release;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment