snprintf and linked server to be respawned, not copied one

This commit is contained in:
maliakal_d 2021-10-19 10:16:31 +02:00
parent 8db1dfb2ce
commit 6cf5072293
2 changed files with 5 additions and 5 deletions

View File

@ -367,10 +367,10 @@ int waitForFPGAtoTouchFlash(char *mess) {
// convert to int
if (sscanf(retvals, "%d\n", &result) != 1) {
sprintf(mess,
"Could not program fpga. (could not scan int for gpio "
"status: [%s])\n",
retvals);
snprintf(mess, MAX_STR_LENGTH,
"Could not program fpga. (could not scan int for gpio "
"status: [%s])\n",
retvals);
LOG(logERROR, (mess));
return FAIL;
}

View File

@ -4301,7 +4301,7 @@ int copy_detector_server(int file_des) {
// add new link name to /etc/inittab
if (ret == OK) {
format = "echo 'ttyS0::respawn:/./%s' >> /etc/inittab";
if (snprintf(cmd, MAX_STR_LENGTH, format, sname) >=
if (snprintf(cmd, MAX_STR_LENGTH, format, LINKED_SERVER_NAME) >=
MAX_STR_LENGTH) {
ret = FAIL;
strcpy(mess, "Could not copy detector server. Command "