thermal: Fix bugprone-use-after-move.

fd was moved out of, so we were adding -1 to the looper.

Bug: http://b/150783499
Test: treehugger

(cherry picked from commit 56ed76601d2fa5f1a1e6f7f24d79975a69f43a39)

Change-Id: Ib571f32078fd9adb91a1e619110330583b75482b
tirimbino
Josh Gao 5 years ago committed by Francescodario Cuzzocrea
parent cba0d8ef11
commit 998e4cfbfb
  1. 2
      hidl/thermal/utils/thermal_watcher.cpp

@ -47,8 +47,8 @@ void ThermalWatcher::registerFilesToWatch(const std::set<std::string> &sensors_t
continue; continue;
} }
watch_to_file_path_map_.emplace(fd.get(), path); watch_to_file_path_map_.emplace(fd.get(), path);
fds_.emplace_back(std::move(fd));
looper_->addFd(fd.get(), 0, Looper::EVENT_INPUT, nullptr, nullptr); looper_->addFd(fd.get(), 0, Looper::EVENT_INPUT, nullptr, nullptr);
fds_.emplace_back(std::move(fd));
} }
monitored_sensors_.insert(sensors_to_watch.begin(), sensors_to_watch.end()); monitored_sensors_.insert(sensors_to_watch.begin(), sensors_to_watch.end());
if (!uevent_monitor) { if (!uevent_monitor) {

Loading…
Cancel
Save