summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2015-09-05 09:49:24 +0000
committerjsg <jsg@openbsd.org>2015-09-05 09:49:24 +0000
commit9ed226c26b7da6452393c9d5a68df02ba5d2f38b (patch)
treedfe211354d3ada56a41093f6f1cdb8dd030e8694
parentAdd brackets to clarify assignments that are the result of a test operator. (diff)
downloadwireguard-openbsd-9ed226c26b7da6452393c9d5a68df02ba5d2f38b.tar.xz
wireguard-openbsd-9ed226c26b7da6452393c9d5a68df02ba5d2f38b.zip
Avoid unintended problems with operator precedence when doing an
assignment and comparison. ok deraadt@ looks correct millert@ jung@
-rw-r--r--usr.bin/bc/tty.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/bc/tty.c b/usr.bin/bc/tty.c
index 6bc85332580..3b2a0407704 100644
--- a/usr.bin/bc/tty.c
+++ b/usr.bin/bc/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.2 2013/11/12 13:54:51 deraadt Exp $ */
+/* $OpenBSD: tty.c,v 1.3 2015/09/05 09:49:24 jsg Exp $ */
/*
* Copyright (c) 2013, Otto Moerbeek <otto@drijf.net>
@@ -29,7 +29,7 @@ settty(struct termios *t)
{
int ret;
- while ((ret = tcsetattr(0, TCSADRAIN, t) == -1) && errno == EINTR)
+ while ((ret = tcsetattr(0, TCSADRAIN, t)) == -1 && errno == EINTR)
continue;
return ret;
}
@@ -39,7 +39,7 @@ gettty(struct termios *t)
{
int ret;
- while ((ret = tcgetattr(0, t) == -1) && errno == EINTR)
+ while ((ret = tcgetattr(0, t)) == -1 && errno == EINTR)
continue;
return ret;
}