Skip to content

Commit

Permalink
stat
Browse files Browse the repository at this point in the history
  • Loading branch information
DanG100 committed Jul 25, 2023
1 parent 93dedb6 commit bd637d0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dataplane/standalone/port.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <fstream>
#include <string>
#include <vector>
#include <sys/stat.h>

#include "absl/strings/str_split.h"
#include "dataplane/standalone/translator.h"
Expand Down Expand Up @@ -50,7 +51,9 @@ sai_status_t Port::create(_In_ uint32_t attr_count,
break;
}
}
bool exists = std::experimental::filesystem::exists("/sys/class/net/" + name);
std::string filename("/sys/class/net/" + name);
struct stat buffer;
bool exists = stat(filename.c_str(), &buffer) == 0;

// TODO(dgrau): Figure out what to do with these ports.
if (type != SAI_PORT_TYPE_CPU && !exists) {
Expand Down

0 comments on commit bd637d0

Please sign in to comment.