Report splice/write errnos, but revert splice fallback

The previous change helped to understand the acutal issue:
EPIPE because our wrapped program did not handle EAGAIN,
see https://github.com/libsndfile/libsndfile/pull/820

This commit reverts 51c0e396
in the sense to not fall back (because the EPIPE would then
be seen after the write()), but improves error reporting.
parent 51c0e396
...@@ -297,6 +297,8 @@ splicer_fallback(const int *fds) ...@@ -297,6 +297,8 @@ splicer_fallback(const int *fds)
if (r == 0) if (r == 0)
break; break;
r = write(fds[1], buf, (size_t)r); r = write(fds[1], buf, (size_t)r);
if (r < 0)
perror("fallback write error");
assert(r >= 0); assert(r >= 0);
assert(r >= 0); assert(r >= 0);
} }
...@@ -318,11 +320,9 @@ splicer(void *a) ...@@ -318,11 +320,9 @@ splicer(void *a)
do { do {
r = splice(fds[0], NULL, fds[1], NULL, SIZE_MAX, r = splice(fds[0], NULL, fds[1], NULL, SIZE_MAX,
SPLICE_F_MORE | SPLICE_F_MOVE); SPLICE_F_MORE | SPLICE_F_MOVE);
if (r == -1) { if (r == -1 && errno == EINVAL)
if (errno != EINVAL)
perror("splicer unexpected error");
return (splicer_fallback(fds)); return (splicer_fallback(fds));
} perror("splicer unexpected error");
assert(r >= 0); assert(r >= 0);
} while (r != 0); } while (r != 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment