Initi commit. There are warning that newer compilers are throwing for vector.at and vector.size. These are removed. In addition a char** in a main parameter was made into a const.

This commit is contained in:
Cyrus 2021-10-27 14:55:50 -04:00
parent cf97b15b13
commit 79127e57d1
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