Skip to content

Commit 085b5e6

Browse files
committed
containers/netns_netlink: Fix system() error handling
If ip fails the return value would be 1 not -1 and also errno is not set. Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
1 parent 7806e44 commit 085b5e6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

testcases/kernel/containers/netns/netns_netlink.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ static void test(void)
140140
}
141141

142142
/* creates TAP network interface dummy0 */
143-
if (WEXITSTATUS(system("ip tuntap add dev dummy0 mode tap")) == -1)
144-
tst_brkm(TBROK | TERRNO, cleanup, "system failed");
143+
if (WEXITSTATUS(system("ip tuntap add dev dummy0 mode tap")))
144+
tst_brkm(TBROK, cleanup, "system() failed");
145145

146146
/* removes previously created dummy0 device */
147-
if (WEXITSTATUS(system("ip tuntap del mode tap dummy0")) == -1)
148-
tst_brkm(TBROK | TERRNO, cleanup, "system failed");
147+
if (WEXITSTATUS(system("ip tuntap del mode tap dummy0")))
148+
tst_brkm(TBROK, cleanup, "system() failed");
149149

150150
/* allow child to continue */
151151
TST_SAFE_CHECKPOINT_WAKE(cleanup, 0);

0 commit comments

Comments
 (0)