- Changed strncpy to strlcpy, strncat to strlcat
- Added strlcpy and strlcat to SICS - Added a driver for the POLDI power supplies SKIPPED: psi/A1931.c psi/autowin.c psi/bruker.c psi/docho.c psi/dornier2.c psi/dspcode.c psi/ease.c psi/ecb.c psi/ecbcounter.c psi/ecbdriv.c psi/el734dc.c psi/el734driv.c psi/el734hp.c psi/el737driv.c psi/el737hpdriv.c psi/el737hpdrivsps.c psi/el737hpv2driv.c psi/el755driv.c psi/eurodriv.c psi/haakedriv.c psi/itc4driv.c psi/julcho.c psi/linadriv.c psi/lmd200.c psi/lscsupport.c psi/ltc11.c psi/make_gen psi/oicom.c psi/oxinst.c psi/pimotor.c psi/pipiezo.c psi/polterwrite.c psi/psi.c psi/sanscook.c psi/sanslirebin.c psi/sanswave.c psi/sinqhmdriv.c psi/sinqhttp.c psi/slsecho.c psi/slsmagnet.c psi/slsvme.c psi/sps.c psi/swmotor.c psi/swmotor2.c psi/tabledrive.c psi/tasscan.c psi/tdchm.c psi/velodorn.c psi/velodornier.c
This commit is contained in:
18
mccontrol.c
18
mccontrol.c
@ -153,7 +153,7 @@ static int invokeScript(pMcStasController self, char *name,
|
||||
int status;
|
||||
|
||||
if (!StringDictGet(self->scripts, name, pScript, 131)) {
|
||||
strncpy(result, "ERROR: script not found", resultLen);
|
||||
strlcpy(result, "ERROR: script not found", resultLen);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ static int invokeScript(pMcStasController self, char *name,
|
||||
|
||||
pTcl = InterpGetTcl(pSics);
|
||||
status = Tcl_Eval(pTcl, pCommand);
|
||||
strncpy(result, pTcl->result, resultLen);
|
||||
strlcpy(result, pTcl->result, resultLen);
|
||||
if (status == TCL_OK) {
|
||||
return 1;
|
||||
} else {
|
||||
@ -280,12 +280,12 @@ int McStasStart(pMcStasController self, CounterMode mode, float fPreset)
|
||||
* make sure that the monitor file has only a 0 in it...
|
||||
*/
|
||||
if (!StringDictGet(self->scripts, "mcmonfile", pResult, 255)) {
|
||||
strncpy(self->errorText, "Misconfiguration: no monfile", 255);
|
||||
strlcpy(self->errorText, "Misconfiguration: no monfile", 255);
|
||||
return HWFault;
|
||||
}
|
||||
fd = fopen(pResult, "w");
|
||||
if (fd == NULL) {
|
||||
strncpy(self->errorText, "Failed to access monitor file", 255);
|
||||
strlcpy(self->errorText, "Failed to access monitor file", 255);
|
||||
return HWFault;
|
||||
}
|
||||
fprintf(fd, "0\n");
|
||||
@ -296,7 +296,7 @@ int McStasStart(pMcStasController self, CounterMode mode, float fPreset)
|
||||
*/
|
||||
status = invokeScript(self, "mcstart", pServ->pSics, pResult, 255);
|
||||
if (status == 0) {
|
||||
strncpy(self->errorText, pResult, 255);
|
||||
strlcpy(self->errorText, pResult, 255);
|
||||
return HWFault;
|
||||
}
|
||||
|
||||
@ -344,7 +344,7 @@ int McStasStatus(pMcStasController self, float *fControl)
|
||||
SicsWait(1);
|
||||
status = invokeScript(self, "mcisrunning", pServ->pSics, pResult, 255);
|
||||
if (status == 0) {
|
||||
strncpy(self->errorText, pResult, 255);
|
||||
strlcpy(self->errorText, pResult, 255);
|
||||
return HWFault;
|
||||
}
|
||||
status = atoi(pResult);
|
||||
@ -428,7 +428,7 @@ int McStasTransferData(pMcStasController self)
|
||||
if (self->pid >= 0) {
|
||||
status = invokeScript(self, "mcdump", pServ->pSics, pResult, 255);
|
||||
if (status == 0) {
|
||||
strncpy(self->errorText, pResult, 255);
|
||||
strlcpy(self->errorText, pResult, 255);
|
||||
self->lastUpdate = time(NULL) - self->updateIntervall;
|
||||
return HWFault;
|
||||
}
|
||||
@ -436,7 +436,7 @@ int McStasTransferData(pMcStasController self)
|
||||
|
||||
status = invokeScript(self, "mccopydata", pServ->pSics, pResult, 255);
|
||||
if (status == 0) {
|
||||
strncpy(self->errorText, pResult, 255);
|
||||
strlcpy(self->errorText, pResult, 255);
|
||||
self->lastUpdate = time(NULL) - self->updateIntervall;
|
||||
return HWFault;
|
||||
}
|
||||
@ -446,7 +446,7 @@ int McStasTransferData(pMcStasController self)
|
||||
/*-------------------------------------------------------------------------*/
|
||||
int McStasGetError(pMcStasController self, char *error, int errLen)
|
||||
{
|
||||
strncpy(error, self->errorText, errLen);
|
||||
strlcpy(error, self->errorText, errLen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user