Searched hist:ae463966 (Results 1 – 1 of 1) sorted by relevance
/openbmc/dbus-sensors/src/ |
H A D | HwmonTempMain.cpp | ae463966 Tue Jan 02 17:35:31 CST 2024 Zhikui Ren <zhikui.ren@intel.com> hwmontempsensor: Handle failure to canonicalize device path
std::filestream::canonical(const std::filesystem::path& p) can throw exception if the path does not exist. hwmontempsensor would crash with: what(): filesystem error: cannot make canonical path: No such file or directory [/sys/class/hwmon/hwmon38/device]
Replace with canonical(const std::filesystem::path& p, std::error_code& ec) which captures error code without exception.
This call still may throw std::bad_alloc if memory allocation fails. But there is no good way to resolve system OOM from this service, leave it unhandled and let the service exit.
Tested: Same hwmontemp sensors are created with the change.
Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> Change-Id: I0cf98950faf44b35dc71387a653ba1feeb375cc1
|