h**o 发帖数: 548 | 1 请问 这会是 什么 错?
func1 call func2, func2 中的printf("end of func2\n")打出来了。然后没执行
printf("after func2\n");却说程序FATAL: Received Segment Violation...dying:
func1(){
...
result = func2();
printf("after func2\n");
...
}
int func2(){
...
printf("end of func2\n");
return result;
}
这是 syslog打出的 错误 信息:
myProcess Parent: recv_fatal_signal on thread #1 pid 3377
myprocess[3371]: [ID 704344 local4.notice] Child process 3377 byebye: 0 0 1
myprocess[3371]: [ID 123356 local4.notice] myProcess P | f******y 发帖数: 2971 | 2 错误在别的地方,你可以吧func2里的 \n去掉试一下 | h**o 发帖数: 548 | 3 Thanks, I have found the reason.
the reason is in func2(),I declared a char* A and xmalloc it, and then I
strlcpy(A, B, sizeof(B)) in which sizeof(B) is larger than sizeof(A), then
when func2 returns, it causes to fatal.
Thanks for your answer.
【在 f******y 的大作中提到】 : 错误在别的地方,你可以吧func2里的 \n去掉试一下
|
|