diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index 09f6a46d61b8eb8f59e095747282c7a7f19fabb4..6d16c4a06587df695535da0fef5aa9f960b0202b 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;