From 6cf50722937875f7066cefb932b15bb9a6864b49 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 19 Oct 2021 10:16:31 +0200 Subject: [PATCH] snprintf and linked server to be respawned, not copied one --- .../slsDetectorServer/src/programFpgaBlackfin.c | 8 ++++---- .../slsDetectorServer/src/slsDetectorServer_funcs.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c b/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c index 0e9dd4117..bfbe08b28 100644 --- a/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c +++ b/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c @@ -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; } diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 3c60843bb..9f7bce19b 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -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 "