fstat失败并带有无效参数

时间:2019-02-28 05:57:52

标签: c linux

fileDes= open(dbPathname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
}
printf("File %s opened successfully with handle %d\n", dbPathname, fileDes );
if(-1 == fileDes)
{
    PERS_ERROR( "pers_db_open_default: File %s opened Failed %d \n", dbPathname, fileDes );
    return NULL; //return PERS_COM_FAILURE;
}

*db = fileDes;
printf("file info:  FD=[%d], &FD=[%d], fileDes=[%d]  \n", (*db),(db), fileDes );

if( 0 != fstat(fileDes, &sb))
{;
    perror("fileInfo() fstat-perror=   \n");
    printf("\nfstat error: [%s] and st.st_mode is [%d]\n",strerror(errno), sb.st_mode);

    return NULL; 
}

输出:-

fileInfo() fstat-perror=
: Invalid argument
Segmentation fault (core dumped)

0 个答案:

没有答案