]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/conf.c
fix fdleak and errors in lxc_create_tty()
authorMichael Tokarev <mjt@tls.msk.ru>
Tue, 24 Nov 2009 08:47:27 +0000 (09:47 +0100)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Tue, 24 Nov 2009 08:47:27 +0000 (09:47 +0100)
commit985d15b106c8959ff130ba5425c2abbe36dc2cca
treecfb0f32bbde110a344dd4c955be0cb904f435b26
parent8f0a524dccd6c0f9b8fb0725449d9a57143d969d
fix fdleak and errors in lxc_create_tty()

if, for some reason, openpty() fails, lxc_create_tty() will
leak all previous ptys and leave the config structure in a
inconsistent state (wrt the number of ptys actually opened)
Fix that by explicitly closing all previously opened ptys
in case of failure and by setting number of actually opened
ttys after actual open

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/conf.c