[Ocfs2-tools-commits] jlbec commits r1371 - branches/cman-based/libo2cb

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Jul 24 14:55:06 PDT 2007


Author: jlbec
Date: 2007-07-24 14:55:05 -0700 (Tue, 24 Jul 2007)
New Revision: 1371

Modified:
   branches/cman-based/libo2cb/o2cb_abi.c
Log:

The toplevel cluster directory in configfs has gained the
heartbeat_available_modes and heartbeat_mode attributes.  However, libo2cb
incorrectly listed regular files (aka, attributes) as cluster names.  Teach
libo2cb to only look at S_ISDIR().



Modified: branches/cman-based/libo2cb/o2cb_abi.c
===================================================================
--- branches/cman-based/libo2cb/o2cb_abi.c	2007-07-18 02:06:56 UTC (rev 1370)
+++ branches/cman-based/libo2cb/o2cb_abi.c	2007-07-24 21:55:05 UTC (rev 1371)
@@ -1122,6 +1122,8 @@
 {
 	errcode_t ret;
 	int count;
+	char statpath[PATH_MAX];
+	struct stat stat_buf;
 	DIR *dir;
 	struct dirent *dirent;
 	struct dlist {
@@ -1160,6 +1162,17 @@
 		if (is_dots(dirent->d_name))
 			continue;
 
+		snprintf(statpath, sizeof(statpath), "%s/%s", path,
+			 dirent->d_name);
+		
+		/* Silently ignore, we can't access it anyway */
+		if (lstat(statpath, &stat_buf))
+			continue;
+
+		/* Non-directories are attributes */
+		if (!S_ISDIR(stat_buf.st_mode))
+			continue;
+
 		tmp = malloc(sizeof(struct dlist));
 		if (!tmp)
 			goto out_free_list;




More information about the Ocfs2-tools-commits mailing list