From: Miklos Szeredi Date: Mon, 8 Nov 2010 20:11:36 +0000 (+0100) Subject: fix pipe cleanup in do_write_buf() X-Git-Tag: fuse_2_9_0~91 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f4d861ed02b698a38f3859856e900fa6e68fa910;p=qemu-gpiodev%2Flibfuse.git fix pipe cleanup in do_write_buf() --- diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index f30156f..2a5e8d2 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -1127,6 +1127,7 @@ static void do_write(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) static void do_write_buf(fuse_req_t req, fuse_ino_t nodeid, const void *inarg, const struct fuse_buf *ibuf) { + struct fuse_ll *f = req->f; struct fuse_buf buf = *ibuf; struct fuse_bufvec bufv = { .buf = &buf, @@ -1157,15 +1158,16 @@ static void do_write_buf(fuse_req_t req, fuse_ino_t nodeid, const void *inarg, if (buf.size < arg->size) { fprintf(stderr, "fuse: do_write_buf: buffer size too small\n"); fuse_reply_err(req, EIO); - return; + goto out; } buf.size = arg->size; req->f->op.write_buf(req, nodeid, &bufv, arg->offset, &fi); +out: /* Need to reset the pipe if ->write_buf() didn't consume all data */ if ((ibuf->flags & FUSE_BUF_IS_FD) && bufv.idx < bufv.count) - fuse_ll_clear_pipe(req->f); + fuse_ll_clear_pipe(f); } static void do_flush(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)