Skip to content

Commit

Permalink
containers/netns_netlink: Fix system() error handling
Browse files Browse the repository at this point in the history
If ip fails the return value would be 1 not -1 and also errno is not
set.

Signed-off-by: Cyril Hrubis <[email protected]>
  • Loading branch information
metan-ucw committed May 9, 2016
1 parent 7806e44 commit 085b5e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions testcases/kernel/containers/netns/netns_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ static void test(void)
}

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

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

/* allow child to continue */
TST_SAFE_CHECKPOINT_WAKE(cleanup, 0);
Expand Down

0 comments on commit 085b5e6

Please sign in to comment.