public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm tools: fix instances enumeration
@ 2011-07-10 12:13 Konstantin Khlebnikov
  0 siblings, 0 replies; only message in thread
From: Konstantin Khlebnikov @ 2011-07-10 12:13 UTC (permalink / raw)
  To: kvm

Calling readdir() with NULL dirp leads to segfault.

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

diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c
index cd3cb19..2ac7b38 100644
--- a/tools/kvm/kvm.c
+++ b/tools/kvm/kvm.c
@@ -172,7 +172,7 @@ int kvm__enumerate_instances(void (*callback)(const char *name, int pid))
 	sprintf(full_name, "%s/%s", HOME_DIR, KVM_PID_FILE_PATH);
 	dir = opendir(full_name);
 
-	for (;;) {
+	for (;dir;) {
 		readdir_r(dir, &entry, &result);
 		if (result == NULL)
 			break;


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-07-10 12:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-10 12:13 [PATCH] kvm tools: fix instances enumeration Konstantin Khlebnikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox