diff --git a/root/root.cpp b/root/root.cpp index 950bd73e1..e54185465 100644 --- a/root/root.cpp +++ b/root/root.cpp @@ -268,6 +268,25 @@ static int bindSocket(struct sockaddr *bindAddr) int main(int argc,char **argv) { + if (argc != 2) { + printf("Usage: zerotier-root []" ZT_EOL_S); + return 1; + } + + std::string myIdStr; + if (!OSUtils::readFile(argv[1],myIdStr)) { + printf("FATAL: cannot read identity.secret at %s" ZT_EOL_S,argv[1]); + return 1; + } + if (!self.fromString(myIdStr.c_str())) { + printf("FATAL: cannot read identity.secret at %s (invalid identity)" ZT_EOL_S,argv[1]); + return 1; + } + if (!self.hasPrivate()) { + printf("FATAL: cannot read identity.secret at %s (missing secret key)" ZT_EOL_S,argv[1]); + return 1; + } + unsigned int ncores = std::thread::hardware_concurrency(); if (ncores == 0) ncores = 1;