- Changed strncpy to strlcpy, strncat to strlcat

- Added strlcpy and strlcat to SICS
- Added a driver for the POLDI power supplies
This commit is contained in:
koennecke
2010-04-13 15:08:40 +00:00
parent 9e4eabeed1
commit dec6b04fa6
49 changed files with 679 additions and 653 deletions

View File

@ -170,7 +170,7 @@ static int checkResponse(pEL734Driv self, char *pReply)
} else if (strstr(pReply, "*ms") != NULL) {
self->errorCode = BADSTP;
} else {
strncpy(self->errorReply, pReply, 79);
strlcpy(self->errorReply, pReply, 79);
self->errorCode = BADUNKNOWN;
}
return 0;
@ -352,52 +352,52 @@ static void EL734Error(void *pData, int *iCode, char *error, int errLen)
*iCode = self->errorCode;
switch (*iCode) {
case BADADR:
strncpy(error, "Bad address", errLen);
strlcpy(error, "Bad address", errLen);
break;
case BADBSY:
strncpy(error, "Motor still busy", errLen);
strlcpy(error, "Motor still busy", errLen);
break;
case BADCMD:
strncpy(error, "Bad command", errLen);
strlcpy(error, "Bad command", errLen);
break;
case BADLOC:
strncpy(error, "Motor controller is on local", errLen);
strlcpy(error, "Motor controller is on local", errLen);
break;
case BADPAR:
strncpy(error, "Bad parameter", errLen);
strlcpy(error, "Bad parameter", errLen);
break;
case BADRNG:
strncpy(error, "Bad range", errLen);
strlcpy(error, "Bad range", errLen);
break;
case BADUNKNOWN:
snprintf(pBueffel, 131, "Unknown response: %s", self->errorReply);
strncpy(error, pBueffel, errLen);
strlcpy(error, pBueffel, errLen);
break;
case BADSTP:
strncpy(error, "Motor is switched off at motor controller", errLen);
strlcpy(error, "Motor is switched off at motor controller", errLen);
break;
case BADEMERG:
strncpy(error, "Emergency stop is engaged, please release", errLen);
strlcpy(error, "Emergency stop is engaged, please release", errLen);
break;
case LOWLIM:
strncpy(error, "Crashed into lower limit switch", errLen);
strlcpy(error, "Crashed into lower limit switch", errLen);
break;
case HILIM:
strncpy(error, "Crashed into upper limit switch", errLen);
strlcpy(error, "Crashed into upper limit switch", errLen);
break;
case RUNFAULT:
strncpy(error, "Run fault detected", errLen);
strlcpy(error, "Run fault detected", errLen);
break;
case POSFAULT:
strncpy(error, "Positioning fault detected", errLen);
strlcpy(error, "Positioning fault detected", errLen);
break;
case BADCUSHION:
strncpy(error, "Air cushion problem", errLen);
strlcpy(error, "Air cushion problem", errLen);
break;
case BADCOUNT:
snprintf(pBueffel, 131, "%d RunFaults, %d PosFaults",
self->runCount, self->posCount);
strncpy(error, pBueffel, errLen);
strlcpy(error, pBueffel, errLen);
break;
default:
getRS232Error(*iCode, error, errLen);