struct osd_node{
int osd_no;
char osd_address[20];
};
struct osd_table{
int osd_count;
struct osd_node *osd;
};
如上结构体,在程序里先执行了这一句,
memcpy(related_osd_table, osdtable.osd, osdtable.osd_count*sizeof(struct osd_node));
这样related_osd_table的osd_count就被覆盖了,然后很悲催地又执行了如下语句:
for(i=0; i< related_osd_table->osd_count; i++){
...
}
然后,然后就很郁闷地查找segment fault的原因,找了N久~~~ 哎~~ 以后用内存拷贝还是小心为妙~~