summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2017-08-31 16:19:22 +0000
committerotto <otto@openbsd.org>2017-08-31 16:19:22 +0000
commit4cf2e7137e39db296dd1c35bf6376239bf6ad351 (patch)
tree40cd98b587e64c5032af160c4862e6da98433b72
parentassorted warning fixes; ok millert@ (diff)
downloadwireguard-openbsd-4cf2e7137e39db296dd1c35bf6376239bf6ad351.tar.xz
wireguard-openbsd-4cf2e7137e39db296dd1c35bf6376239bf6ad351.zip
enum can be signed or unsigned depending on the compiler; so make sure we
cast to unsigned and test for > X to avoid warnings that comparing an unsigned < 0 make no sense; ok deraadt@
-rw-r--r--usr.sbin/sasyncd/carp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/sasyncd/carp.c b/usr.sbin/sasyncd/carp.c
index 856fc5c1b46..358e807939e 100644
--- a/usr.sbin/sasyncd/carp.c
+++ b/usr.sbin/sasyncd/carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: carp.c,v 1.15 2016/08/27 04:21:08 guenther Exp $ */
+/* $OpenBSD: carp.c,v 1.16 2017/08/31 16:19:22 otto Exp $ */
/*
* Copyright (c) 2005 Håkan Olsson. All rights reserved.
@@ -154,7 +154,7 @@ carp_state_name(enum RUNSTATE state)
{
static const char *carpstate[] = CARPSTATES;
- if (state < 0 || state > FAIL)
+ if ((unsigned)state > FAIL)
state = FAIL;
return carpstate[state];
}
@@ -163,7 +163,7 @@ void
carp_update_state(enum RUNSTATE current_state)
{
- if (current_state < 0 || current_state > FAIL) {
+ if ((unsigned)current_state > FAIL) {
log_err("carp_update_state: invalid carp state, abort");
cfgstate.runstate = FAIL;
return;