Menu

#355 mplay.c control flow error prevents proper device initialization

Future
open
nobody
None
na
2019-12-03
2019-12-03
seahawk1986
No

Hello,
it has been brought to my attention that the mplay2 driver does not work in recent lircd versions (https://www.vdr-portal.de/forum/index.php?thread/133184-gel%C3%B6st-yavdr-ansible-mplay2-fernbedienung-funktioniert-nicht/).

We discovered a control flow error introduced in https://sourceforge.net/p/lirc/git/ci/00e11da0ea30ce83cb9472bfd01c9f72f589bebc/tree//plugins/mplay.c?diff=9c596ec5570826df20d609a62ae9fd9510307b5c which causes the device to be only partially initialized. The if ... else if ... else structure used to check for errors during initialization requires that none of the statements evaluates to something other than 0 (true) or the following steps won't be executed.

If there were no errors up to the check in https://sourceforge.net/p/lirc/git/ci/00e11da0ea30ce83cb9472bfd01c9f72f589bebc/tree/plugins/mplay.c#l695 , the else if block is executed, so the chain is broken early, regardless if opening the serial port worked.

Attached is a patch to fix this issue, which uses a goto construct in case an error occurs, so it is easier to follow the control flow.

1 Attachments

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.