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

Stéphane Graber stgraber at ubuntu.com
Wed Jan 2 17:54:16 UTC 2013


On 12/31/2012 02:02 PM, Dwight Engen wrote:
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>

Looks good, thanks. Pushed.

Acked-by: Stéphane Graber <stgraber at ubuntu.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;
> 


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130102/4048b250/attachment.pgp>


More information about the lxc-devel mailing list