9pfs: fix bogus fd check in local_remove()
PATCH 1/1 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 <[email protected]>
--- hw/9pfs/9p-local.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/9pfs/9p-local.c +1 -1
@@ -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; }
Quoted 11 lines · Greg Kurz
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 <[email protected]>--- hw/9pfs/9p-local.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by Eric Blake <[email protected]>
Quoted 16 lines
hw/9pfs/9p-local.c +1
-1@@ -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; }
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org