summaryrefslogtreecommitdiffstats
path: root/src/backlight
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-02-22 15:00:46 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-02-22 15:00:46 +0100
commit7a9737bc7d8b9879099459dfb96358281b4b3d60 (patch)
tree54749d3a3f37c4f4e8f009fa898336356acde97b /src/backlight
parenttest-network: test wireguard peer in drop-in config (diff)
downloadsystemd-7a9737bc7d8b9879099459dfb96358281b4b3d60.tar.xz
systemd-7a9737bc7d8b9879099459dfb96358281b4b3d60.zip
backlight: exit earlier when unknown verb is specified
Diffstat (limited to 'src/backlight')
-rw-r--r--src/backlight/backlight.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
index f3d53d6462..f9e4f83ab9 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -388,6 +388,9 @@ static int run(int argc, char *argv[]) {
if (argc != 3)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program requires two arguments.");
+ if (!STR_IN_SET(argv[1], "load", "save"))
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown verb %s.", argv[1]);
+
umask(0022);
r = mkdir_p("/var/lib/systemd/backlight", 0755);
@@ -503,7 +506,7 @@ static int run(int argc, char *argv[]) {
return log_device_error_errno(device, r, "Failed to write %s: %m", saved);
} else
- return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown verb %s.", argv[1]);
+ assert_not_reached("Unknown verb.");
return 0;
}