From: Miklos Szeredi Date: Mon, 26 Aug 2013 09:33:33 +0000 (+0200) Subject: Don't close -1 fd in fuse_chan_destroy() X-Git-Tag: fuse-3.0.0pre0~101 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f4bb7265fddf8c7e1f186d53f1e07fdccfbe8d00;p=qemu-gpiodev%2Flibfuse.git Don't close -1 fd in fuse_chan_destroy() Valgrind warns on close(-1). So don't do this (happens if fuse_chan_clearfd() was called on the channel). --- diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index c88b4a7..0f1c3d3 100755 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -224,7 +224,9 @@ static int fuse_chan_send(struct fuse_chan *ch, const struct iovec iov[], void fuse_chan_close(struct fuse_chan *ch) { - close(fuse_chan_fd(ch)); + int fd = fuse_chan_fd(ch); + if (fd != -1) + close(fd); }