-
Kir Kolyshkin authored
1. As pointed out by Coverity (CID 114629), mnt_ns_fd is closed, but then the function calls try_clean_remaps(mnt_ns_fd) which tries to close the file descriptor which is already closed. To address this, let's use safe_close() which sets closed fd to -1. As it also checks its argument, there's no need for explicit check so let's remove "if" check before close(). 2. As Pavel pointed out, "calling the whole try_clean_remaps() is not required once we've passed the cleanup_mnt_ns() point". This could be addressed by introducing yet another label, but it's cleaner to just use a flag variable. Note that since the second issue is being addressed, the first one goes away, but let's keep the fix for it anyway, it might help in the future. Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@parallels.com>
44562737