aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2017-03-06 17:34:01 +0100
committerGreg Kurz <groug@kaod.org>2017-03-06 17:34:01 +0100
commitb7361d46e75f12d8d943ca8d33ef82cafce39920 (patch)
tree8361e686339dc6aced4763a98a603fbd56ab94fd /hw/9pfs
parent56b51708e9e22809d2a78f38d0ac84bb3f3fca92 (diff)
downloadqemu-b7361d46e75f12d8d943ca8d33ef82cafce39920.zip
qemu-b7361d46e75f12d8d943ca8d33ef82cafce39920.tar.gz
qemu-b7361d46e75f12d8d943ca8d33ef82cafce39920.tar.bz2
9pfs: fix bogus fd check in local_remove()
This was spotted by Coverity as a fd leak. This is certainly true, but also local_remove() would always return without doing anything, unless the fd is zero, which is very unlikely. (Coverity issue CID1371732) Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'hw/9pfs')
-rw-r--r--hw/9pfs/9p-local.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index f22a3c3..5db7104 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -1008,7 +1008,7 @@ static int local_remove(FsContext *ctx, const char *path)
int err = -1;
dirfd = local_opendir_nofollow(ctx, dirpath);
- if (dirfd) {
+ if (dirfd == -1) {
goto out;
}