The error return from open is -1, so test that, not 0, for success/failure.
Resolves-Coverity-CID: 1125931 Signed-off-by: Eric Sandeen <sand...@redhat.com> --- cmds-filesystem.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmds-filesystem.c b/cmds-filesystem.c index e6642ef..df9d1ff 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -362,13 +362,13 @@ static int btrfs_scan_kernel(void *search) } fd = open(mnt->mnt_dir, O_RDONLY); - if (fd > 0 && !get_df(fd, &space_info_arg)) { + if ((fd != -1) && !get_df(fd, &space_info_arg)) { get_label_mounted(mnt->mnt_dir, label); print_one_fs(&fs_info_arg, dev_info_arg, space_info_arg, label, mnt->mnt_dir); free(space_info_arg); } - if (fd > 0) + if (fd != -1) close(fd); free(dev_info_arg); } -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html