aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_linux.h
diff options
context:
space:
mode:
Diffstat (limited to 'executor/common_linux.h')
-rw-r--r--executor/common_linux.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h
index 38b67ef3e..35dff507d 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -653,9 +653,10 @@ static void netdevsim_add(unsigned int addr, unsigned int port_count)
char buf[16];
sprintf(buf, "%u %u", addr, port_count);
- write_file("/sys/bus/netdevsim/new_device", buf);
- snprintf(buf, sizeof(buf), "netdevsim%d", addr);
- initialize_devlink_ports("netdevsim", buf, "netdevsim");
+ if (write_file("/sys/bus/netdevsim/new_device", buf)) {
+ snprintf(buf, sizeof(buf), "netdevsim%d", addr);
+ initialize_devlink_ports("netdevsim", buf, "netdevsim");
+ }
}
// We test in a separate namespace, which does not have any network devices initially (even lo).