Fix host under macOS

>w<
This commit is contained in:
sech1p 2021-11-04 15:33:04 +01:00
parent f12b15c6c6
commit e5094a7258
No known key found for this signature in database
GPG key ID: 44917CFA577DA652

View file

@ -690,10 +690,15 @@ void get_info()
break;
}
}
#elif defined(__FREEBSD__)
host_model_info = popen("sysctl -a hw.hv_vendor", "r");
#elif defined(__FREEBSD__) || defined(__APPLE__)
#if defined(__FREEBSD__)
#define HOSTCTL "hw.hv_vendor"
#elif defined(__APPLE__)
#define HOSTCTL "hw.model"
#endif
host_model_info = popen("sysctl -a " HOSTCTL, "r");
while (fgets(line, sizeof(line), host_model_info))
if (sscanf(line, "hw.hv_vendor: %[^\n]", host_model))
if (sscanf(line, HOSTCTL ": %[^\n]", host_model))
break;
#endif // __WINDOWS__
FILE *host_model_version = fopen("/sys/devices/virtual/dmi/id/product_version", "r");