From: Greg Kurz Date: Mon, 6 Mar 2017 16:34:01 +0000 (+0100) Subject: 9pfs: fix bogus fd check in local_remove() X-Git-Tag: v2.8.1~79 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=719e6dd1713cca2413214af36c9ef9c0be041810;p=thirdparty%2Fqemu.git 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 Reviewed-by: Eric Blake (cherry picked from commit b7361d46e75f12d8d943ca8d33ef82cafce39920) Signed-off-by: Greg Kurz Signed-off-by: Michael Roth --- diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index a87617df1e0..a50a01f03ba 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; }