File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ class TelemetryArrayLinux : public TelemetryArrayInterface
68
68
TelemetryArrayLinux (const size_t uid_, const size_t instance_): uid(uid_), instance(instance_)
69
69
{
70
70
assert (instance < numInstances (uid));
71
- load ();
71
+ TelemetryArrayLinux:: load ();
72
72
}
73
73
static size_t numInstances (const size_t uid)
74
74
{
@@ -92,7 +92,13 @@ class TelemetryArrayLinux : public TelemetryArrayInterface
92
92
assert (file);
93
93
// get the file size
94
94
fseek (file, 0 , SEEK_END);
95
- size_t fileSize = ftell (file);
95
+ const auto pos = ftell (file);
96
+ if (pos < 0 )
97
+ {
98
+ std::cerr << " Error: failed to get file size" << std::endl;
99
+ return ;
100
+ }
101
+ const size_t fileSize = pos;
96
102
fseek (file, 0 , SEEK_SET);
97
103
data.resize (fileSize);
98
104
const size_t bytesRead = fread (data.data (), 1 , fileSize, file);
You can’t perform that action at this time.
0 commit comments