From 45f57ebeb7d3f212c05031ab4f80d40629049c54 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Mon, 4 Apr 2022 12:41:30 +0200 Subject: [PATCH] compile, wip --- .../slsDetectorServer/src/common.c | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/slsDetectorServers/slsDetectorServer/src/common.c b/slsDetectorServers/slsDetectorServer/src/common.c index 50c7ab855..ffefbb231 100644 --- a/slsDetectorServers/slsDetectorServer/src/common.c +++ b/slsDetectorServers/slsDetectorServer/src/common.c @@ -653,31 +653,32 @@ int deleteFile(char *mess, char *fname, char *errorPrefix) { LOG(logERROR, (mess)); return FAIL; } -} -if (access(fullname, F_OK) == 0) { - char cmd[MAX_STR_LENGTH] = {0}; - char retvals[MAX_STR_LENGTH] = {0}; + if (access(fullname, F_OK) == 0) { + char cmd[MAX_STR_LENGTH] = {0}; + char retvals[MAX_STR_LENGTH] = {0}; - if (snprintf(cmd, MAX_STR_LENGTH, "rm %s", fullname) >= MAX_STR_LENGTH) { - sprintf(mess, "Could not %s. Command to delete is too long\n", - errorPrefix); - LOG(logERROR, (mess)); - return FAIL; + if (snprintf(cmd, MAX_STR_LENGTH, "rm %s", fullname) >= + MAX_STR_LENGTH) { + sprintf(mess, "Could not %s. Command to delete is too long\n", + errorPrefix); + LOG(logERROR, (mess)); + return FAIL; + } + + if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) { + snprintf(mess, MAX_STR_LENGTH, + "Could not %s. (deleting file %s). %s\n", errorPrefix, + fullname, retvals); + LOG(logERROR, (mess)); + return FAIL; + } + LOG(logINFO, ("\tDeleted file: %s (%s)\n", fullname, errorPrefix)); + } else { + LOG(logINFO, + ("\tFile does not exist anyway: %s (%s)\n", fullname, errorPrefix)); } - - if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) { - snprintf(mess, MAX_STR_LENGTH, "Could not %s. (deleting file %s). %s\n", - errorPrefix, fullname, retvals); - LOG(logERROR, (mess)); - return FAIL; - } - LOG(logINFO, ("\tDeleted file: %s (%s)\n", fullname, errorPrefix)); -} else { - LOG(logINFO, - ("\tFile does not exist anyway: %s (%s)\n", fullname, errorPrefix)); -} -return OK; + return OK; } int deleteOldServers(char *mess, char *newServerPath, char *errorPrefix) {