summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <t.j.smeding@uu.nl>2022-03-30 10:41:08 +0200
committerTom Smeding <t.j.smeding@uu.nl>2022-03-30 10:41:08 +0200
commit989334821826bc16adf8d3c93a5a9d6be813b796 (patch)
tree87e147f52dd7ac517293d59fab1b887c71ae839e
parent4be4ac3e289fe4c555877841fa76d7b514625e1f (diff)
Don't set brightness if parsing target value failed
-rw-r--r--brightness.cpp3
1 files changed, 2 insertions, 1 deletions
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));
}