aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Neuhalfen2016-04-14 19:58:07 +0200
committerGert Doering2016-04-17 19:05:49 +0200
commitb582af4b62325596231e9e34135b49c5115519e5 (patch)
tree34c5b526d302768d6c441a4c681ebc259c383f94
parent17b22f9da909f0193dff30860b45673d9cd6c509 (diff)
downloadopenvpn-b582af4b62325596231e9e34135b49c5115519e5.zip
openvpn-b582af4b62325596231e9e34135b49c5115519e5.tar.gz
Make intent of utun device name validation clear
Make intend of the validation clear when validating utun parameter in open_darwin_utun. The program logic remains unchanged. Fixes the following compiler warning on Mac OS X: tun.c:2847:19: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses] if (dev_node && !strcmp ("utun", dev_node)==0) ^ ~~ tun.c:2847:19: note: add parentheses after the '!' to evaluate the comparison first if (dev_node && !strcmp ("utun", dev_node)==0) ^ ( ) tun.c:2847:19: note: add parentheses around left hand side expression to silence this warning if (dev_node && !strcmp ("utun", dev_node)==0) ^ ( ) tun.c:2849:11: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses] if (!sscanf (dev_node, "utun%d", &utunnum)==1) ^ ~~ tun.c:2849:11: note: add parentheses after the '!' to evaluate the comparison first if (!sscanf (dev_node, "utun%d", &utunnum)==1) ^ ( ) tun.c:2849:11: note: add parentheses around left hand side expression to silence this warning if (!sscanf (dev_node, "utun%d", &utunnum)==1) ^ ( ) Signed-off-by: Jens Neuhalfen <jens@neuhalfen.name> Acked-by: Arne Schwabe <arne@rfc2549.org> Message-Id: <3365AB24-33FD-4D9D-A57C-BF9240DC3D69@neuhalfen.name> URL: http://article.gmane.org/gmane.network.openvpn.devel/11440 Signed-off-by: Gert Doering <gert@greenie.muc.de> (cherry picked from commit 6be0f0015d7485f0bf3c14a3a381a6f6496270a5)
-rw-r--r--src/openvpn/tun.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index bb019c0..b70410d 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -2626,9 +2626,9 @@ open_darwin_utun (const char *dev, const char *dev_type, const char *dev_node, s
/* dev_node is simply utun, do the normal dynamic utun
* otherwise try to parse the utun number */
- if (dev_node && !strcmp ("utun", dev_node)==0)
+ if (dev_node && (strcmp("utun", dev_node) != 0 ))
{
- if (!sscanf (dev_node, "utun%d", &utunnum)==1)
+ if (sscanf(dev_node, "utun%d", &utunnum) != 1 )
msg (M_FATAL, "Cannot parse 'dev-node %s' please use 'dev-node utunX'"
"to use a utun device number X", dev_node);
}