From 48af1841823a96aa85a7b7c91324eebcf800b22f Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sat, 9 Apr 2011 13:38:16 +0300 Subject: [PATCH] kvm tools: Close kernel FD after loading it into memory Once the kernel has been loaded into the guest memory, close the FD of the file. [ penberg@kernel.org: remove unnecessary fd >= 0 checks ] Signed-off-by: Sasha Levin Signed-off-by: Pekka Enberg --- tools/kvm/kvm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c index af1f65ffcebe..7ca44210fbf7 100644 --- a/tools/kvm/kvm.c +++ b/tools/kvm/kvm.c @@ -385,9 +385,13 @@ bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename, if (ret) goto found_kernel; + close(fd_kernel); + die("%s is not a valid bzImage or flat binary", kernel_filename); found_kernel: + close(fd_kernel); + return ret; } -- 2.39.5