ploop copy: improve error message

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
ploop copy -s -d: remove file in case of failure

In case ploop copy send form is used to write directly to a file,
we create the file in tools/ploop-copy.c and we should remove it
in case ploop_copy_send() failed. While at it, close fd as well.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
lib/pcopy.c: mark send_thread() as static

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
ploop_copy_send_param: remove ofd_is_pipe

There is no need to explicitly specify if a file descriptor
is a pipe/socket or not, as we can just use stat() to find it out.

While at it, move the check for valid fd from plooptool_copy()
to ploop_copy_send(), and make it more strict -- instead of checking
that FD is not a TTY we require a file, a pipe, or a socket.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
ploop_copy_receive(): improve fd checks

Use is_fd_pipe() to check both input fd and feedback fd.
Also, print fd in error message.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
ploop_copy_send(): add check for feedback_fd

If feedback_fd is specified, check that it is a pipe or a socket.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>