[Bug 253736] backlight(8) arg parsing can be tricked in a small way
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sat Feb 27 19:02:16 UTC 2021
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253736
--- Comment #2 from David Schlachter <fbsd-bugzilla at schlachter.ca> ---
Simple fix:
diff --git a/usr.bin/backlight/backlight.c b/usr.bin/backlight/backlight.c
index 1dae0cfe5c6..180b9114876 100644
--- a/usr.bin/backlight/backlight.c
+++ b/usr.bin/backlight/backlight.c
@@ -98,7 +98,7 @@ main(int argc, char *argv[])
BACKLIGHTGETSTATUS,
BACKLIGHTUPDATESTATUS,
BACKLIGHTGETINFO};
- long percent = 0;
+ long percent = -1;
const char *percent_error;
uint32_t i;
bool setname;
@@ -196,7 +196,7 @@ main(int argc, char *argv[])
case BACKLIGHT_DECR:
if (ioctl(fd, BACKLIGHTGETSTATUS, &props) == -1)
errx(1, "Cannot query the backlight device");
- percent = percent == 0 ? 10 : percent;
+ percent = percent == -1 ? 10 : percent;
percent = action == BACKLIGHT_INCR ? percent : -percent;
props.brightness += percent;
if ((int)props.brightness < 0)
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list