Skip to content

Commit 73e4595

Browse files
committed
Add fallback
1 parent 14f03c0 commit 73e4595

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pkg/inventory/systeminfo/hosthardware_darwin.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ DeviceInfo getDeviceInfo(void) {
3737

3838
NSDictionary *platform = getServiceProperties(IOServiceMatching("IOPlatformExpertDevice"));
3939
if (platform) {
40-
info.found = true;
4140
info.modelIdentifier = copyStringProperty(platform, @"model");
4241
info.serialNumber = copyStringProperty(platform, @"IOPlatformSerialNumber");
4342

@@ -57,6 +56,9 @@ DeviceInfo getDeviceInfo(void) {
5756
if (product) {
5857
info.productName = copyStringProperty(product, @"product-name");
5958
}
59+
if (!product || !info.productName) {
60+
info.productName = strdup(info.modelIdentifier);
61+
}
6062

6163
return info;
6264
}

pkg/inventory/systeminfo/hosthwardware_darwin.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <stdbool.h>
55

66
typedef struct {
7-
bool found;
87
char *modelIdentifier;
98
char *modelNumber;
109
char *productName;

0 commit comments

Comments
 (0)