[PATCH] kvm tools: ignore nonexisting custom stage2

Konstantin Khlebnikov
2011-12-21T09:15:13Z

fix permanent failing with message "Fatal: Failed linking stage 2 of init."
if there is no custom init_stage2.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
---
tools/kvm/builtin-run.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
index fac274c..094c0fa2 100644
--- a/tools/kvm/builtin-run.c
+++ b/tools/kvm/builtin-run.c
@@ -752,7 +752,7 @@ static int kvm_custom_stage2(void)

src = realpath("guest/init_stage2", NULL);
if (src == NULL)
- return -ENOMEM;
+ return errno == ENOENT ? 0 : -errno;

snprintf(tmp, PATH_MAX, "%s%s/virt/init_stage2", kvm__get_dir(), rootfs);
remove(tmp);