add some return values to some shit so it shuts down elegantly on crash

This commit is contained in:
2026-01-15 00:19:53 +01:00
parent 6297317f93
commit 7929a687e8
11 changed files with 105 additions and 64 deletions

View File

@@ -65,14 +65,15 @@ void sys::getNetwork(Network* net, const std::string& device) {
prev = current;
}
void sys::detectHwmon(sysSensors* s, const std::string& platform) {
int sys::detect(sysSensors* s, const std::string& platform) {
// we dont really need getFirstDir since its a static folder, but its useful for try/catch
try {
s->hwmon = utils::getFirstDir("/sys/devices/platform/" + platform + "/hwmon");
} catch (...) {
applog(LOG::ERR, "Can't open sys hwmon. Module loaded? Kernel params added?");
return;
return -1;
}
return 0;
}
void sys::updateSensors(sysSensors* s) {