Skip to content

Commit 7438b50

Browse files
Janosch MachowinskiJanosch Machowinski
Janosch Machowinski
authored and
Janosch Machowinski
committed
fix: Fixed inverted check
Signed-off-by: Janosch Machowinski <[email protected]>
1 parent c8cdcba commit 7438b50

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

rosbag2_compression/src/rosbag2_compression/sequential_compression_writer.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,17 @@ void SequentialCompressionWriter::compression_thread_fn()
9595

9696
errno = 0;
9797
int cur_nice_value = getpriority(PRIO_PROCESS, 0);
98-
if (cur_nice_value != -1 && errno == 0) {
98+
if (cur_nice_value == -1 && errno != 0) {
99+
ROSBAG2_COMPRESSION_LOG_WARN_STREAM(
100+
"Could not set nice value of compression thread to " << wanted_nice_value <<
101+
" : Could not determine cur nice value");
102+
} else {
99103
int new_nice_value = nice(wanted_nice_value - cur_nice_value);
100-
if ((new_nice_value == -1 && errno != 0) || new_nice_value != wanted_nice_value) {
104+
if ((new_nice_value == -1 && errno != 0)) {
101105
ROSBAG2_COMPRESSION_LOG_WARN_STREAM(
102106
"Could not set nice value of compression thread to " << wanted_nice_value << " : " << std::strerror(
103107
errno));
104108
}
105-
} else {
106-
ROSBAG2_COMPRESSION_LOG_WARN_STREAM(
107-
"Could not set nice value of compression thread to " << wanted_nice_value <<
108-
" : Could not determine cur nice value");
109109
}
110110
#endif
111111
}

0 commit comments

Comments
 (0)