corrected bug: core dump when TecsInit fails
This commit is contained in:
@ -1116,6 +1116,7 @@
|
|||||||
pNew = CreateEVController(pDriv,argv[2],&iRet);
|
pNew = CreateEVController(pDriv,argv[2],&iRet);
|
||||||
if(!pNew)
|
if(!pNew)
|
||||||
{
|
{
|
||||||
|
TecsError(pDriv, &iRet, pError, sizeof(pError)-1);
|
||||||
SCWrite(pCon,"ERROR creating Environment Controller",eError);
|
SCWrite(pCon,"ERROR creating Environment Controller",eError);
|
||||||
DeleteEVDriver(pDriv);
|
DeleteEVDriver(pDriv);
|
||||||
return 0;
|
return 0;
|
||||||
|
10
tecsdriv.c
10
tecsdriv.c
@ -64,11 +64,6 @@
|
|||||||
|
|
||||||
#include "evdriver.i"
|
#include "evdriver.i"
|
||||||
|
|
||||||
/*------------------------- The Driver ------------------------------------*/
|
|
||||||
|
|
||||||
pEVDriver CreateTecsDriver(int argc, char *argv[]);
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *pData;
|
void *pData;
|
||||||
@ -81,6 +76,7 @@
|
|||||||
static time_t lastGet=0;
|
static time_t lastGet=0;
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
int TecsWrapper(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int TecsWrapper(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[])
|
int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -188,7 +184,7 @@
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
static int TecsError(pEVDriver self, int *iCode, char *error, int iErrLen)
|
int TecsError(pEVDriver self, int *iCode, char *error, int iErrLen)
|
||||||
{
|
{
|
||||||
pTecsDriv pMe = NULL;
|
pTecsDriv pMe = NULL;
|
||||||
|
|
||||||
@ -253,7 +249,7 @@
|
|||||||
{
|
{
|
||||||
pMe->iLastError = 1; /* severe */
|
pMe->iLastError = 1; /* severe */
|
||||||
pMe->lastError = ErrMessage;
|
pMe->lastError = ErrMessage;
|
||||||
return 0;
|
return -1; /* fatal */
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user