[Sheepdog] Segmentation fault

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Tue Mar 9 12:00:28 CET 2010


Hi,

On 2010/03/09 14:32, jjxiong2009 at hotmail.com wrote:
> Hi, List,
> 
> I met a Segmentation fault error with the command './shepherd info -t obj', below the the full information,
> is there any solution from you?
> 
Thanks for your report.
Could you try the following patch?

---
 shepherd/shepherd.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/shepherd/shepherd.c b/shepherd/shepherd.c
index 78037ed..db28f77 100644
--- a/shepherd/shepherd.c
+++ b/shepherd/shepherd.c
@@ -682,9 +682,9 @@ static void get_oid(uint64_t oid, char *name, uint32_t tag,
 	struct get_oid_info *info = data;
 	char *p;

-	p = strchr(info->name, ':');
-
 	if (info->name) {
+		p = strchr(info->name, ':');
+
 		if (p) {
 			if (!strncmp(name, info->name, p - info->name) &&
 			    tag == strtoul(p + 1, NULL, 16))
@@ -806,6 +806,10 @@ static void print_obj(char *vdiname, unsigned index)
 	ret = parse_vdi(get_oid, &info);

 	oid = info.oid;
+	if (oid == 0) {
+		printf("No such vdi\n");
+		return;
+	}

 	if (index == ~0) {
 		printf("Looking for the inode object 0x%" PRIx64 " with %d nodes\n\n",
@@ -956,6 +960,10 @@ rerun:
 		ret = 0;
 		break;
 	case INFO_OBJ:
+		if (!name) {
+			printf("Please specify the vdiname\n");
+			break;
+		}
 		print_obj(name, index);
 		ret = 0;
 		break;
-- 
1.5.6.5



More information about the sheepdog mailing list