File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4240,7 +4240,7 @@ struct VM {
42404240 }
42414241 u16 cycleThreshold = 1200 ;
42424242 if (util::hyper_x () == HYPERV_ARTIFACT_VM) {
4243- cycleThreshold = 15000 ; // if we're running under Hyper-V, attempt to detect nested virtualization only
4243+ cycleThreshold = 8000 ; // if we're running under Hyper-V, attempt to detect nested virtualization only
42444244 }
42454245
42464246 #if (WINDOWS)
@@ -5624,14 +5624,28 @@ struct VM {
56245624 * @implements VM::HYPERV_HOSTNAME
56255625 */
56265626 [[nodiscard]] static bool hyperv_hostname () {
5627+ std::string hostname;
5628+
5629+ #if (WINDOWS)
56275630 char buf[MAX_COMPUTERNAME_LENGTH + 1 ];
56285631 DWORD len = sizeof (buf);
56295632
5630- if (!GetComputerNameA (buf, &len)) {
5633+ if (GetComputerNameA (buf, &len)) {
5634+ hostname.assign (buf, len);
5635+ }
5636+ else {
56315637 return false ;
56325638 }
5639+ #elif (LINUX)
5640+ char buf[HOST_NAME_MAX];
56335641
5634- std::string hostname (buf, len);
5642+ if (gethostname (buf, sizeof (buf)) == 0 ) {
5643+ hostname = buf;
5644+ }
5645+ else {
5646+ return false ;
5647+ }
5648+ #endif
56355649
56365650 const char * prefix = " runnervm" ;
56375651 const std::size_t prefix_len = std::strlen (prefix);
You can’t perform that action at this time.
0 commit comments