Roll back failed password and advert changes, propagate identity-store results, and report unsaved common and observer settings. Correct observer filter persistence and KISS OTA capability claims. Add fault-injection and packaging regressions.
22 lines
612 B
C++
22 lines
612 B
C++
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
|
|
// Legacy setters can apply live settings before saving. Never let their final
|
|
// OK overwrite a persistence error, including through nested CLI dispatch.
|
|
class PrefsSaveReplyGuard {
|
|
const uint32_t& _failures;
|
|
const uint32_t _start;
|
|
char* _reply;
|
|
|
|
public:
|
|
PrefsSaveReplyGuard(const uint32_t& failures, char* reply)
|
|
: _failures(failures), _start(failures), _reply(reply) {}
|
|
~PrefsSaveReplyGuard() {
|
|
if (_failures != _start) {
|
|
strcpy(_reply, "Error: settings not saved; unsaved changes may remain active until reboot");
|
|
}
|
|
}
|
|
};
|