projects
/
platform
/
upstream
/
pulseaudio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
114a429
)
padsp: Fix flush and improve error handling
author
Peter Meerwald-Stadler
<pmeerw@pmeerw.net>
Wed, 17 Aug 2016 21:52:17 +0000
(23:52 +0200)
committer
Peter Meerwald-Stadler
<pmeerw@pmeerw.net>
Fri, 2 Sep 2016 12:52:53 +0000
(14:52 +0200)
read() can return a number of bytes read less than k
in addition, handle EAGAIN and EOF
CID
1137981
src/utils/padsp.c
patch
|
blob
|
history
diff --git
a/src/utils/padsp.c
b/src/utils/padsp.c
index 943479b39d092f129832fafeeaf80bb7585f7e9c..7a94114f067c79faf7236c14ff5cd44c9c8da1cd 100644
(file)
--- a/
src/utils/padsp.c
+++ b/
src/utils/padsp.c
@@
-1768,11
+1768,18
@@
static int dsp_flush_fd(int fd) {
while (l > 0) {
char buf[1024];
size_t k;
+ ssize_t r;
k = (size_t) l > sizeof(buf) ? sizeof(buf) : (size_t) l;
- if (read(fd, buf, k) < 0)
+ r = read(fd, buf, k);
+ if (r < 0) {
+ if (errno == EAGAIN)
+ break;
debug(DEBUG_LEVEL_NORMAL, __FILE__": read(): %s\n", strerror(errno));
- l -= k;
+ return -1;
+ } else if (r == 0)
+ break;
+ l -= r;
}
return 0;