From 989334821826bc16adf8d3c93a5a9d6be813b796 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Wed, 30 Mar 2022 10:41:08 +0200 Subject: Don't set brightness if parsing target value failed --- brightness.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/brightness.cpp b/brightness.cpp index c06427d..9fe8221 100644 --- a/brightness.cpp +++ b/brightness.cpp @@ -110,7 +110,7 @@ private: } public: - int increment() const { return 100; } + int increment() const { return 1000; } bool suitable() { struct stat st; @@ -229,6 +229,7 @@ int main(int argc,char **argv){ int n = strtol(argv[1], &endp, 10); if (argv[1][0] == '\0' || *endp != '\0') { std::cerr << "Invalid number '" << argv[1] << "'" << std::endl; + return 1; } backlight->set_brightness(backlight->convert_absolute_brightness(n)); } -- cgit v1.2.3-70-g09d2