Skip to content

Commit

Permalink
Fix partial PCM write in bluealsa-cli open command
Browse files Browse the repository at this point in the history
  • Loading branch information
borine authored and arkq committed Feb 16, 2021
1 parent a6895bd commit a749b1b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion utils/cli/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,15 @@ static int cmd_open(int argc, char *argv[]) {
char buffer[4096];
while ((count = read(input, buffer, sizeof(buffer))) > 0) {
ssize_t written = 0;
const char *pos = buffer;
while (written < count) {
ssize_t res = write(output, buffer, count - written);
ssize_t res = write(output, pos, count - written);
if (res <= 0) {
/* Cannot write any more, so just terminate */
goto finish;
}
written += res;
pos += res;
}
}

Expand Down

0 comments on commit a749b1b

Please sign in to comment.