diff options
author | Alexandre Rostovtsev <tetromino@gentoo.org> | 2012-09-06 01:03:34 -0400 |
---|---|---|
committer | Alexandre Rostovtsev <tetromino@gentoo.org> | 2012-09-06 01:09:08 -0400 |
commit | 30d1b0efed5f89eb3969937aa9d8695081b1aabb (patch) | |
tree | 3e52c3c7da943ab8c5fd0c925d92a250f04449b0 /src | |
parent | Fix memory leaks (diff) | |
download | openrc-settingsd-30d1b0efed5f89eb3969937aa9d8695081b1aabb.tar.gz openrc-settingsd-30d1b0efed5f89eb3969937aa9d8695081b1aabb.tar.bz2 openrc-settingsd-30d1b0efed5f89eb3969937aa9d8695081b1aabb.zip |
Use rc_sys for vm detection
Diffstat (limited to 'src')
-rw-r--r-- | src/hostnamed.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/hostnamed.c b/src/hostnamed.c index 1fb14c0..b476cdb 100644 --- a/src/hostnamed.c +++ b/src/hostnamed.c @@ -26,6 +26,8 @@ #include <gio/gio.h> #include <polkit/polkit.h> +#include <rc.h> + #include "hostnamed.h" #include "hostname1-generated.h" #include "utils.h" @@ -68,10 +70,15 @@ hostname_is_valid (const gchar *name) static gchar * guess_icon_name () { - /* TODO: detect virtualization by reading rc_sys */ gchar *filebuf = NULL; gchar *ret = NULL; + /* Note that rc_sys() leaks memory :( */ + if (rc_sys() != NULL) { + ret = g_strdup ("computer-vm"); + goto out; + } + #if defined(__i386__) || defined(__x86_64__) /* Taken with a few minor changes from systemd's hostnamed |