mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-09 07:08:10 +02:00
spa: alsa: pcm: log_write(): fix return value
The `fopencookie()` write callback should return the number of consumed
bytes, but it currently only ever returns 0, which signals an error
condition according to the documentation.
Fix that by not overwriting `size`.
Fixes: 73073eb33f ("alsa: redirect alsa output to log file")
This commit is contained in:
parent
ff7b996596
commit
bba43d4433
1 changed files with 3 additions and 2 deletions
|
|
@ -718,12 +718,13 @@ static ssize_t log_write(void *cookie, const char *buf, size_t size)
|
|||
struct state *state = cookie;
|
||||
int len;
|
||||
|
||||
while (size > 0) {
|
||||
for (size_t left = size; left > 0; ) {
|
||||
len = strcspn(buf, "\n");
|
||||
|
||||
if (len > 0)
|
||||
spa_log_debug(state->log, "%.*s", (int)len, buf);
|
||||
buf += len + 1;
|
||||
size -= len + 1;
|
||||
left -= len + 1;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue