From: Konstantin Khlebnikov <khlebnikov@openvz.org>
To: <kvm@vger.kernel.org>
Subject: [PATCH] kvm tools: fix instances enumeration
Date: Sun, 10 Jul 2011 16:13:27 +0400 [thread overview]
Message-ID: <20110710121327.2081.32899.stgit@localhost6> (raw)
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;
reply other threads:[~2011-07-10 12:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110710121327.2081.32899.stgit@localhost6 \
--to=khlebnikov@openvz.org \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox