Skip to content

Commit 3ba2823

Browse files
committed
change sysctl call in device data source
1 parent ab8c25c commit 3ba2823

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Sources/Instrumentation/SDKResourceExtension/DataSource/DeviceDataSource.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,8 @@ public class DeviceDataSource: IDeviceDataSource {
2929
// Returned 'error #12: Optional("Cannot allocate memory")' because len was not initialized properly.
3030

3131
let desiredLen = UnsafeMutablePointer<Int>.allocate(capacity: 1)
32-
let lenRequestError = sysctl(hwName, 2, nil, desiredLen, nil, 0)
33-
if lenRequestError != 0 {
34-
// TODO: better error log
35-
print("error #\(errno): \(String(describing: String(utf8String: strerror(errno))))")
36-
37-
return nil
38-
}
32+
33+
sysctl(hwName, 2, nil, desiredLen, nil, 0)
3934

4035
let machine = UnsafeMutablePointer<CChar>.allocate(capacity: desiredLen[0])
4136
let len: UnsafeMutablePointer<Int>! = UnsafeMutablePointer<Int>.allocate(capacity: 1)

0 commit comments

Comments
 (0)