diff --git a/lib/libzfs_core/libzfs_core.c b/lib/libzfs_core/libzfs_core.c index f3e505265d73..0d74aa2133f4 100644 --- a/lib/libzfs_core/libzfs_core.c +++ b/lib/libzfs_core/libzfs_core.c @@ -652,8 +652,9 @@ send_worker(void *arg) * Returns the error from func(), if nonzero, * otherwise the error from the thread. * - * No-op if orig_fd is -1, already a pipe, and on not-Linux; - * as such, it is safe to wrap/call wrapped functions in a wrapped context. + * No-op if orig_fd is -1, already a pipe (but the buffer size is bumped), + * and on not-Linux; as such, it is safe to wrap/call wrapped functions + * in a wrapped context. */ int lzc_send_wrapper(int (*func)(int, void *), int orig_fd, void *data) @@ -662,8 +663,11 @@ lzc_send_wrapper(int (*func)(int, void *), int orig_fd, void *data) struct stat sb; if (orig_fd != -1 && fstat(orig_fd, &sb) == -1) return (errno); - if (orig_fd == -1 || S_ISFIFO(sb.st_mode)) + if (orig_fd == -1 || S_ISFIFO(sb.st_mode)) { + if (orig_fd != -1) + (void) max_pipe_buffer(orig_fd); return (func(orig_fd, data)); + } if ((fcntl(orig_fd, F_GETFL) & O_ACCMODE) == O_RDONLY) return (errno = EBADF);