Skip to content

Commit

Permalink
Fixes reading has_realtime property
Browse files Browse the repository at this point in the history
Reading this from system may end up in undefined behavior. (#306)
  • Loading branch information
axelschroth authored and fmauch committed May 21, 2021
1 parent e5e8fcf commit d7c0144
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ur_robot_driver/src/hardware_interface_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ int main(int argc, char** argv)
signal(SIGINT, signalHandler);

std::ifstream realtime_file("/sys/kernel/realtime", std::ios::in);
bool has_realtime;
realtime_file >> has_realtime;
bool has_realtime = false;
if (realtime_file.is_open())
{
realtime_file >> has_realtime;
}
if (has_realtime)
{
const int max_thread_priority = sched_get_priority_max(SCHED_FIFO);
Expand Down

0 comments on commit d7c0144

Please sign in to comment.