帮忙看看是什么错误,谢谢

Taosim Taosim 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
//db2abnd.c
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <stdlib.h>
#include <locale.h>
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <pwd.h>
#include "usersys.h"

void db2abnd(msg_dat)
struct msgdata *msg_dat;
{
int space;

memset((char *)&space,' ',sizeof(int));

if( msg_dat->d.errmno == space )
{
msg_dat->d.errmno = 0;
}

msg_dat->d.class1 = 9500;

memset(&msg_dat->d.command[7],NULL,1);

sprintf(msg_dat->d.msgdat, "%8s:ERR:DATABASE '%8s' ERROR",
msg_dat->d.pgname, msg_dat->d.command);

MSnd_Rcv(msg_dat, msg_dat);
}

//usersys.h
#define UMSGNOLEN 8 /* length of no */
#define UMSGIDLEN 16 /* length of id */
#define UMSGLEN 80 /* length of message */
#define UMSGDTLEN 500 /* length of data */

struct MSGDAT
{
int class1; /* message class1 */
int class2; /* message class2 */
int errmno; /* error message
int inpcnt; /* input count */
int outcnt; /* output count */
int inscnt; /* insert count */
int updcnt; /* update count */
int delcnt; /* delete count */
int fetcnt; /* fetch count */
int flsize; /* file size */
int sqlcod; /* sqlcode */
char command[UMSGNOLEN]; /* command name */
char msgno[UMSGNOLEN]; /* message number */
char pgname[UMSGIDLEN]; /* program name */
char htname[UMSGIDLEN]; /* host name */
char tablid[UMSGIDLEN]; /* table name */
char userid[UMSGIDLEN]; /* user id */
char dispid[UMSGIDLEN]; /* display id */
char msgdat[UMSGLEN]; /* message data */
char fldata[UMSGDTLEN]; /* data */
};

struct msgdata
{
long pid; /* process id */
struct MSGDAT d; /* message data */
};

程序编译执行时在if( msg_dat->d.errmno == space )处
发生错误,提示:Segmentation Fault - core dumped
谁能帮我解释一下是什么错误,谢谢。

...全文
评论 2
收藏 已收藏
分享
返回顶部
Taosim
Linux/Unix社区 23,224 成员 74,535 内容