From: Greg Kurz <gr...@kaod.org> If we cannot open the given path, we can return right away instead of passing -1 to fstatfs() and close(). This will make Coverity happy.
(Coverity issue CID1371729) Signed-off-by: Greg Kurz <gr...@kaod.org> Reviewed-by: Daniel P. berrange <berra...@redhat.com> Reviewed-by: Eric Blake <ebl...@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4...@amsat.org> (cherry picked from commit 23da0145cc4be66fdb1033f951dbbf140f457896) Signed-off-by: Greg Kurz <gk...@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdr...@linux.vnet.ibm.com> --- hw/9pfs/9p-local.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index c5f7dcd..09b9b57 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -1054,6 +1054,9 @@ static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf) int fd, ret; fd = local_open_nofollow(s, fs_path->data, O_RDONLY, 0); + if (fd == -1) { + return -1; + } ret = fstatfs(fd, stbuf); close_preserve_errno(fd); return ret; -- 2.7.4