From: Jens Axboe Date: Wed, 13 Jun 2007 13:13:17 +0000 (+0200) Subject: vmsplice-touser: -z requires -m X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=1e404f5c8c94728623a0954c9a6cb5445d793c85;p=splice.git vmsplice-touser: -z requires -m And fix buffer assignment. Signed-off-by: Jens Axboe --- diff --git a/vmsplice-touser.c b/vmsplice-touser.c index b5cc9bc..75e789d 100644 --- a/vmsplice-touser.c +++ b/vmsplice-touser.c @@ -49,6 +49,7 @@ static int do_vmsplice(int fd, unsigned char **buf, int len) return error("poll"); written = svmsplice(fd, &iov, 1, splice_flags); + *buf = iov.iov_base; if (written < 0) return error("vmsplice"); @@ -63,8 +64,6 @@ static int do_vmsplice(int fd, unsigned char **buf, int len) } } - if (!*buf) - *buf = iov.iov_base; return ret; } @@ -131,6 +130,11 @@ int main(int argc, char *argv[]) if (check_input_pipe()) return usage(argv[0]); + if (do_zeromap && !(splice_flags & SPLICE_F_MOVE)) { + fprintf(stderr, "zero map only valid for -m(ove)\n"); + return usage(argv[0]); + } + if (!do_zeromap) { buf = malloc(4096); memset(buf, 0, 4096);