chiark / gitweb /
backlight: Avoid error when state restore is disabled
authorMichael Biebl <biebl@debian.org>
Wed, 10 Sep 2014 22:49:36 +0000 (00:49 +0200)
committerMichael Biebl <biebl@debian.org>
Wed, 10 Sep 2014 22:53:49 +0000 (00:53 +0200)
When the state restore is disabled, we would print:
"Unknown verb: load" instead of simply skipping loading the
state.

src/backlight/backlight.c

index 4d94ebf58a7e30b6b5ed7ad345a5235336f52b8e..0a2bac6f1665427207370f67e95b23913ec994d1 100644 (file)
@@ -372,9 +372,12 @@ int main(int argc, char *argv[]) {
          * device probing should be complete), so that the validity
          * check at boot time doesn't have to be reliable. */
 
-        if (streq(argv[1], "load") && shall_restore_state()) {
+        if (streq(argv[1], "load")) {
                 _cleanup_free_ char *value = NULL;
 
+                if (!shall_restore_state())
+                        return EXIT_SUCCESS;
+
                 if (!validate_device(udev, device))
                         return EXIT_SUCCESS;