Re: [mpg123-devel] 'Unfinished command' when operating in remote mode
Brought to you by:
sobukus
From: Thomas O. <tho...@or...> - 2022-09-13 08:39:06
|
Am Tue, 6 Sep 2022 11:36:17 +0000 schrieb Jonathan Yong <10...@gm...>: > Am I getting the problem correctly? If REMOTE_BUFFER_SIZE is too small, > the path longer than it will never work. It's two things: 1. too small buffer and 2. read() returning only a piece of the command. The latter case was not handled correctly. I added this change now: Index: src/control_generic.c =================================================================== --- src/control_generic.c (revisión: 5149) +++ src/control_generic.c (revisión: 5150) @@ -907,7 +907,7 @@ // Last character not nulled if we did not use all command text. if(buf[len-1] != 0) { - if(next_comstr == buf) + if(next_comstr == buf && len == REMOTE_BUFFER_SIZE) { generic_sendmsg("E Too long command, cannot parse."); // Just skipping it, provoking furhter parsing erros, but maybe not fatal. This should be all that's required … I tested by limiting the read() to 10 bytes, and also checking the proper error case with a small buffer size. Neil, can you confirm with the current trunk or snapshot? Alrighty then, Thomas PS: Oh, just saw the typo of „furhter“ in the comment. Well … I guess I'm pedantic enough to fix that, too. |