Closed jxir closed 7 months ago
The intention of the following code is to skip . and .. while looping over the entries of a directory: https://github.com/Hummer12007/brightnessctl/blob/66eba7f87bea5a28a59560da6a1e34256c177f8e/brightnessctl.c#L486-L487
.
..
However, due to the use of the logical AND operator && instead of an logical OR operator ||, the if condition will always be false.
&&
||
if
The loop will still work as intended, because the rest of the loop body code is behind this condition: https://github.com/Hummer12007/brightnessctl/blob/66eba7f87bea5a28a59560da6a1e34256c177f8e/brightnessctl.c#L488-L489 which will not be met if the entry name is . or ...
Suggested fixes:
486-487
The intention of the following code is to skip
.
and..
while looping over the entries of a directory: https://github.com/Hummer12007/brightnessctl/blob/66eba7f87bea5a28a59560da6a1e34256c177f8e/brightnessctl.c#L486-L487However, due to the use of the logical AND operator
&&
instead of an logical OR operator||
, theif
condition will always be false.The loop will still work as intended, because the rest of the loop body code is behind this condition: https://github.com/Hummer12007/brightnessctl/blob/66eba7f87bea5a28a59560da6a1e34256c177f8e/brightnessctl.c#L488-L489 which will not be met if the entry name is
.
or..
.Suggested fixes:
&&
with||
.486-487
entirely.