diff --git a/src/net.c b/src/net.c index cd0d99df..b5eed6ae 100644 --- a/src/net.c +++ b/src/net.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "hyper.h" #include "util.h" @@ -169,6 +170,10 @@ static int hyper_get_ifindex(char *nic) sprintf(path, "/sys/class/net/%s/ifindex", nic); fprintf(stdout, "net device sys path is %s\n", path); + while (access(path, R_OK) < 0) { + sched_yield(); + } + fd = open(path, O_RDONLY); if (fd < 0) { perror("can not open file");