Hummer12007 / brightnessctl

A program to read and control device brightness
Other
900 stars 48 forks source link

Inconsequential error in loop control logic #99

Closed jxir closed 7 months ago

jxir commented 8 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.

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: