aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2017-03-06 17:34:01 +0100
committerMichael Roth <mdroth@linux.vnet.ibm.com>2017-03-16 12:08:41 -0500
commit719e6dd1713cca2413214af36c9ef9c0be041810 (patch)
treeec09738e86e87108d61ea537c08b06476f71abab /hw
parent05a92c2005956540c379150a7eb99c5ec44fa6f9 (diff)
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> (cherry picked from commit b7361d46e75f12d8d943ca8d33ef82cafce39920) Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-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 a87617df1e..a50a01f03b 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -1009,7 +1009,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;
}