Skip to content

Commit c26efdc

Browse files
author
Ignacio Bonafonte
authored
Merge pull request #369 from open-telemetry/sysctl-change
change sysctl call in device data source
2 parents 2b4a99c + 3ba2823 commit c26efdc

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)