[lxc-devel] [PATCH 2/6] coverity: open can return 0 as an fd, change error check to < 0
Dwight Engen
dwight.engen at oracle.com
Tue May 7 14:57:09 UTC 2013
Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
---
src/lxc/bdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c
index 1a611f9..181e98e 100644
--- a/src/lxc/bdev.c
+++ b/src/lxc/bdev.c
@@ -90,7 +90,7 @@ static int blk_getsize(const char *path, unsigned long *size)
int fd, ret;
fd = open(path, O_RDONLY);
- if (!fd)
+ if (fd < 0)
return -1;
ret = ioctl(fd, BLKGETSIZE64, size);
close(fd);
--
1.8.1.4
More information about the lxc-devel
mailing list