[lxc-devel] [PATCH] fix open check (0 is a valid fd)

Dwight Engen dwight.engen at oracle.com
Mon Dec 31 19:02:49 UTC 2012


Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
---
 src/lxc/console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/console.c b/src/lxc/console.c
index 73bec78..c3f892b 100644
--- a/src/lxc/console.c
+++ b/src/lxc/console.c
@@ -145,7 +145,7 @@ static int get_default_console(char **console)
 
 	if (!access("/dev/tty", F_OK)) {
 		fd = open("/dev/tty", O_RDWR);
-		if (fd > 0) {
+		if (fd >= 0) {
 			close(fd);
 			*console = strdup("/dev/tty");
 			goto out;
-- 
1.7.12.3





More information about the lxc-devel mailing list