[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] 9pfs: fail local_statfs() earlier
From: |
Greg Kurz |
Subject: |
[Qemu-devel] [PATCH] 9pfs: fail local_statfs() earlier |
Date: |
Fri, 03 Mar 2017 19:03:47 +0100 |
User-agent: |
StGit/0.17.1-20-gc0b1b-dirty |
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 <address@hidden>
---
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 fe930300445a..ea9a1ced0394 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -1053,6 +1053,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;
- [Qemu-devel] [PATCH] 9pfs: fail local_statfs() earlier,
Greg Kurz <=