TpFanDriver::~TpFanDriver() { std::ofstream f(path_); try { f.exceptions(f.failbit | f.badbit); f << "level " << initial_state_ << std::flush; } catch (std::ios_base::failure &e) { throw IOerror(MSG_FAN_RESET(path_), errno); } }
HwmonFanDriver::~HwmonFanDriver() { std::ofstream f(path_ + "_enable"); try { f.exceptions(f.failbit | f.badbit); f << initial_state_ << std::flush; } catch (std::ios_base::failure &e) { string msg = std::strerror(errno); throw SystemError(MSG_FAN_RESET(path_) + msg); } }
HwmonFanDriver::~HwmonFanDriver() { try { std::ofstream f(path_ + "_enable"); f.exceptions(f.failbit | f.badbit); f << initial_state_ << std::endl; } catch (std::exception &e) { string msg = std::strerror(errno); fail(TF_WRN) << MSG_FAN_RESET(path_) << SystemError(string(e.what()) + ": " + msg) << flush; } }