summaryrefslogtreecommitdiff
path: root/src/host.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/host.c')
-rw-r--r--src/host.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/host.c b/src/host.c
index ee88778..72b4cdf 100644
--- a/src/host.c
+++ b/src/host.c
@@ -63,9 +63,13 @@ const char *run_host_command(const char *command) {
void display_host_model() {
#if defined(__OpenBSD__)
- printf("%s", run_host_command("sysctl -n hw.vendor && echo \" \" && "
- "sysctl -n hw.version && echo \" \" &&"
- "sysctl -n hw.product"));
+ const char *cmd = run_host_command("sysctl -n hw.vendor && echo \" \" && "
+ "if [ \"$(sysctl -n hw.version 2>&1)\" != "
+ "\"sysctl: hw.version: value is not available\" ]; then "
+ "sysctl -n hw.version && echo \" \"; fi && "
+ "sysctl -n hw.product");
+ printf("%s", cmd);
+ free((void *)cmd);
#elif defined(__FreeBSD__)
const char *family = run_host_command("kenv | grep smbios.system.family | "
"sed 's/\"//g' | sed 's/smbios.system.family=//'");