mirror of
https://github.com/systemd/systemd.git
synced 2024-10-31 16:21:26 +03:00
backlight: exit earlier when unknown verb is specified
This commit is contained in:
parent
84d32bf59b
commit
7a9737bc7d
@ -388,6 +388,9 @@ static int run(int argc, char *argv[]) {
|
|||||||
if (argc != 3)
|
if (argc != 3)
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program requires two arguments.");
|
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);
|
umask(0022);
|
||||||
|
|
||||||
r = mkdir_p("/var/lib/systemd/backlight", 0755);
|
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);
|
return log_device_error_errno(device, r, "Failed to write %s: %m", saved);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown verb %s.", argv[1]);
|
assert_not_reached("Unknown verb.");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user