mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
rcinput: fix corrupted iterator on input device hot-unplug
Origin commit data
------------------
Branch: ni/coolstream
Commit: 36951c8141
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2017-09-06 (Wed, 06 Sep 2017)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1304,7 +1304,10 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::vector<in_dev>::iterator i = indev.begin(); i != indev.end(); ++i) {
|
/* iterate backwards or the vector will be corrupted by the indev.erase(i) */
|
||||||
|
std::vector<in_dev>::iterator i = indev.end();
|
||||||
|
while (i != indev.begin()) {
|
||||||
|
--i;
|
||||||
if (((*i).fd != -1) && (FD_ISSET((*i).fd, &rfds))) {
|
if (((*i).fd != -1) && (FD_ISSET((*i).fd, &rfds))) {
|
||||||
uint64_t now_pressed = 0;
|
uint64_t now_pressed = 0;
|
||||||
t_input_event ev;
|
t_input_event ev;
|
||||||
@@ -1316,7 +1319,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6
|
|||||||
if (errno == ENODEV) {
|
if (errno == ENODEV) {
|
||||||
/* hot-unplugged? */
|
/* hot-unplugged? */
|
||||||
::close((*i).fd);
|
::close((*i).fd);
|
||||||
indev.erase(i);
|
i = indev.erase(i);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user