Commit 23da0145 authored by Greg Kurz's avatar Greg Kurz
Browse files

9pfs: fail local_statfs() earlier



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: default avatarGreg Kurz <groug@kaod.org>
Reviewed-by: default avatarDaniel P. berrange <berrange@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
parent faab207f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;