mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-29 21:37:54 -04: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;
|
struct state *state = cookie;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
while (size > 0) {
|
for (size_t left = size; left > 0; ) {
|
||||||
len = strcspn(buf, "\n");
|
len = strcspn(buf, "\n");
|
||||||
|
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
spa_log_debug(state->log, "%.*s", (int)len, buf);
|
spa_log_debug(state->log, "%.*s", (int)len, buf);
|
||||||
buf += len + 1;
|
buf += len + 1;
|
||||||
size -= len + 1;
|
left -= len + 1;
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue