[lxc-devel] [lxc/master] conf: fix net type checks in run_script_argv()

aither64 on Github lxc-bot at linuxcontainers.org
Fri Apr 13 07:17:57 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 578 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180413/8a8cda97/attachment.bin>
-------------- next part --------------
From a81442634ed8ef08ba428a529e3ec83e6aad72be Mon Sep 17 00:00:00 2001
From: Jakub Skokan <jakub.skokan at havefun.cz>
Date: Thu, 12 Apr 2018 20:01:43 +0200
Subject: [PATCH] conf: fix net type checks in run_script_argv()

Signed-off-by: Jakub Skokan <jakub.skokan at havefun.cz>
---
 src/lxc/conf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 283a58218..a6e600ff9 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -440,7 +440,7 @@ int run_script_argv(const char *name, unsigned int hook_version,
 
 			parent = argv[1] ? argv[1] : "";
 
-			if (strcmp(argv[0], "macvlan")) {
+			if (strcmp(argv[0], "macvlan") == 0) {
 				ret = setenv("LXC_NET_PARENT", parent, 1);
 				if (ret < 0) {
 					SYSERROR("Failed to set environment "
@@ -448,7 +448,7 @@ int run_script_argv(const char *name, unsigned int hook_version,
 					goto on_error;
 				}
 				TRACE("Set environment variable: LXC_NET_PARENT=%s", parent);
-			} else if (strcmp(argv[0], "phys")) {
+			} else if (strcmp(argv[0], "phys") == 0) {
 				ret = setenv("LXC_NET_PARENT", parent, 1);
 				if (ret < 0) {
 					SYSERROR("Failed to set environment "
@@ -456,7 +456,7 @@ int run_script_argv(const char *name, unsigned int hook_version,
 					goto on_error;
 				}
 				TRACE("Set environment variable: LXC_NET_PARENT=%s", parent);
-			} else if (strcmp(argv[0], "veth")) {
+			} else if (strcmp(argv[0], "veth") == 0) {
 				char *peer = argv[2] ? argv[2] : "";
 
 				ret = setenv("LXC_NET_PEER", peer, 1);


More information about the lxc-devel mailing list