- 论坛徽章:
- 0
|
int OpenLogFile(char *FilName)
{
char itasLogFile[256];
memset(itasLogFile,0x00,sizeof(itasLogFile));
if( NULL == getenv("ITASLOGDIR")){ /*获得环境变量中设置的程序的目录*/
return FAILED;
}
memcpy(itasLogFile,getenv("ITASLOGDIR"),strlen(getenv("ITASLOGDIR"))); /*保存环境变量*/
strcat(itasLogFile,"/");
strcat(itasLogFile,FilName);
if((LogFile = fopen(itasLogFile,"a")) == NULL){
return FAILED;
}
if(0!=(setvbuf(LogFile,NULL,_IONBF,0))){
return FAILED;
}
return SUCCESS;
} |
环境描述:AXI5.3
程序在执行到setvbuf一行时
直接coredump
用dbx查看core文件,信息如下:
(dbx) where
leftmost(??, ??) at 0xd03af44c
malloc_y(0x18, 0x0, 0x4, 0x0, 0x117b809f, 0x17b809f, 0x0, 0x0) at 0xd03b1204
malloc_common_80_63(??) at 0xd034260c
malloc(??) at 0xd0342460
setvbuf_unlocked(??, ??, ??, ??) at 0xd04a3d64
setvbuf(??, ??, ??, ??) at 0xd04a3ea8
OpenLogFile(FilName = "VTHDETOA20150708"), line 98 in "writelog.c"
还请各位大侠帮忙看下什么原因? |
|