fix a couple of cases of writing the wrong token

This commit is contained in:
Grant Limberg 2023-07-06 14:38:24 -07:00
parent 27cc1b2301
commit dc23957872
No known key found for this signature in database
GPG key ID: 8F2F97D3BE8D7735

View file

@ -978,8 +978,8 @@ public:
Utils::getSecureRandom(foo,sizeof(foo));
_metricsToken = "";
for(unsigned int i=0;i<sizeof(foo);++i)
_authToken.push_back("abcdefghijklmnopqrstuvwxyz0123456789"[(unsigned long)foo[i] % 36]);
if (!OSUtils::writeFile(metricsTokenPath.c_str(),_authToken)) {
_metricsToken.push_back("abcdefghijklmnopqrstuvwxyz0123456789"[(unsigned long)foo[i] % 36]);
if (!OSUtils::writeFile(metricsTokenPath.c_str(),_metricsToken)) {
Mutex::Lock _l(_termReason_m);
_termReason = ONE_UNRECOVERABLE_ERROR;
_fatalErrorMessage = "metricstoken.secret could not be written";