cluster: master - qdisk: fix possible has_holder value leak
Fabio M. Di Nitto
fabbione at fedoraproject.org
Thu Nov 19 09:17:39 UTC 2009
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=739dc5c76d55bf71c91370a3c711cc4ae80adf9d
Commit: 739dc5c76d55bf71c91370a3c711cc4ae80adf9d
Parent: eb8ec0b6d1a38f12a03e52183595c31b96b75d85
Author: Fabio M. Di Nitto <fdinitto at redhat.com>
AuthorDate: Thu Nov 19 09:34:43 2009 +0100
Committer: Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Thu Nov 19 10:17:30 2009 +0100
qdisk: fix possible has_holder value leak
thanks to Bud Brown for spotting this possible bug.
Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
---
cman/qdisk/scandisk.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/cman/qdisk/scandisk.c b/cman/qdisk/scandisk.c
index 8195e00..3825ec4 100644
--- a/cman/qdisk/scandisk.c
+++ b/cman/qdisk/scandisk.c
@@ -626,7 +626,7 @@ static int sysfs_is_disk(char *path)
static int scansysfs(struct devlisthead *devlisthead, const char *path, int level, int parent_holder)
{
struct devnode *startnode;
- int i, n, maj, min, has_holder = 0;
+ int i, n, maj, min, has_holder;
struct dirent **namelist;
struct stat sb;
char newpath[MAXPATHLEN];
@@ -644,6 +644,8 @@ static int scansysfs(struct devlisthead *devlisthead, const char *path, int leve
if (S_ISLNK(sb.st_mode))
continue;
+ has_holder = parent_holder;
+
if (sysfs_is_dev(newpath, &maj, &min) > 0) {
startnode =
alloc_list_obj(devlisthead, maj,
@@ -657,12 +659,10 @@ static int scansysfs(struct devlisthead *devlisthead, const char *path, int leve
if (!parent_holder)
has_holder =
- startnode->sysfsattrs.holders =
sysfs_has_subdirs_entries(newpath,
"holders");
- else
- has_holder =
- startnode->sysfsattrs.holders = parent_holder;
+
+ startnode->sysfsattrs.holders = has_holder;
startnode->sysfsattrs.slaves =
sysfs_has_subdirs_entries(newpath,
More information about the cluster-commits
mailing list