Skip to content

Commit

Permalink
led-relay: Logic error in if statement.
Browse files Browse the repository at this point in the history
The fclose function call returns 0 on success, reverse the logic.

Signed-off-by: Andreas Egeberg <[email protected]>
  • Loading branch information
Andreas Egeberg committed Aug 19, 2021
1 parent 0ce6a74 commit 995100a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/led-relay/led-relay.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,18 @@ int main(int argc, char *argv[])
break;

case 'c':
if (!set_led("0", optarg))
if (set_led("0", optarg))
errx(1, "Failed clearing LED %s", optarg);
flash_led("none", optarg);
break;

case 'f':
if (!flash_led("timer", optarg))
if (flash_led("timer", optarg))
errx(1, "Failed flashing LED %s", optarg);
break;

case 'g':
if (!get_led(val, sizeof(val), optarg))
if (get_led(val, sizeof(val), optarg))
return 1;
puts(val);
break;
Expand All @@ -170,7 +170,7 @@ int main(int argc, char *argv[])
return usage(0, prog);

case 's':
if (!set_led("1", optarg))
if (set_led("1", optarg))
errx(1, "Failed setting LED %s", optarg);
break;

Expand Down

0 comments on commit 995100a

Please sign in to comment.