From 8d17af9cc111d50a8b0be9ff2f35a9b333290781 Mon Sep 17 00:00:00 2001 From: Miciah Masters Date: Sat, 24 Dec 2016 03:23:43 -0500 Subject: -r/--restore requires root, same as set The -r/--restore flag requires root, the same as the set verb does, so print an error message if either the flag or the verb is used without running as root. --- brightnessctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'brightnessctl.c') diff --git a/brightnessctl.c b/brightnessctl.c index d6170e9..86a0e21 100644 --- a/brightnessctl.c +++ b/brightnessctl.c @@ -172,7 +172,7 @@ int main(int argc, char **argv) { fail("Invalid value given"); if (!(dev = find_device(devs, dev_name))) fail("Device '%s' not found.\n", dev_name); - if (p.operation == SET && !p.pretend && geteuid()) + if ((p.operation == SET || p.restore) && !p.pretend && geteuid()) fail("You need to run this program as root to be able to modify values!\n"); if (p.save) if (save_device_data(dev)) -- cgit v1.2.3