Merge pull request #413 from nsacyber/cpp-compiler-warning-fix

Cpp Compiler Warning fixes
This commit is contained in:
Cyrus 2021-10-27 16:12:36 -04:00 committed by GitHub
commit 04a66da5f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -208,15 +208,18 @@ hirs::pb::OsInfo DeviceInfoCollector::collectOsInfo() {
while (getline(releaseFile, line)) {
stringstream ss(line);
string item;
vector<string> tokens;
std::vector<string> tokens;
char* delim = const_cast<char*>("=");
while (getline(ss, item, *delim)) {
tokens.push_back(item);
}
if (tokens.size() > 0 && tokens.at(0) == "ID") {
info.set_distribution(tokens.at(1));
} else if (tokens.size() > 0 && tokens.at(0) == "VERSION_ID") {
info.set_distributionrelease(tokens.at(1));
for (int i=0; i < tokens.size(); i++) {
if (tokens[i] == "ID") {
info.set_distribution(tokens[i+1]);
}
if (tokens[i] == "VERSION_ID") {
info.set_distributionrelease(tokens[i+1]);
}
}
}
releaseFile.close();

View File

@ -178,7 +178,7 @@ void printHelp() {
cout << helpMessage.str() << endl;
}
int main(int argc, char** argv) {
int main(int argc, const char** argv) {
string log_directory = "/var/log/hirs/provisioner";
// directory should be created by rpm install