From 6189fd157a296a25aa809540201591790c331595 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 28 May 2020 09:19:55 +0200 Subject: [PATCH 1/2] gotthard2: cehck if module attached when setting veto to 1 --- .../src/slsDetectorServer_funcs.c | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 800754f7e..d04f15212 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -7454,10 +7454,39 @@ int set_veto(int file_des) { #else // only set if (Server_VerifyLock() == OK) { - setVeto(arg); - int retval = getVeto(); - LOG(logDEBUG1, ("veto mode retval: %u\n", retval)); - validate(arg, retval, "set veto mode", DEC); + // veto allowed only if module attached or in -nomodule mode + if (checkModuleFlag) { + int type_ret = checkDetectorType(); + if (type_ret == -1) { + ret = FAIL; + sprintf( + mess, + "Could not enable/disable veto streaming. Could not open " + "file to know if module attached.\n"); + LOG(logERROR, (mess)); + } else if (type_ret == -2) { + ret = FAIL; + sprintf(mess, "Could not enable/disable veto streaming. No " + "module attached!\n"); + LOG(logERROR, (mess)); + } else if (type_ret == FAIL) { + ret = FAIL; + sprintf(mess, "Could not enable/disable veto streaming. Wrong " + "module type " + "attached!\n"); + LOG(logERROR, (mess)); + } + } else { + LOG(logINFOBLUE, + ("In No-Module mode: Ignoring module-attached check. " + "Continuing to enable/disable veto streaming.\n")); + } + if (ret == OK) { + setVeto(arg); + int retval = getVeto(); + LOG(logDEBUG1, ("veto mode retval: %u\n", retval)); + validate(arg, retval, "set veto mode", DEC); + } } #endif return Server_SendResult(file_des, INT32, NULL, 0); From d175ba0936434a70e8b3bdafc3b7be3b0b32cad4 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 28 May 2020 09:21:19 +0200 Subject: [PATCH 2/2] check for module attached only when enabling veto streaming, not disabling --- .../src/slsDetectorServer_funcs.c | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index d04f15212..3a25f608e 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -7455,31 +7455,32 @@ int set_veto(int file_des) { // only set if (Server_VerifyLock() == OK) { // veto allowed only if module attached or in -nomodule mode - if (checkModuleFlag) { - int type_ret = checkDetectorType(); - if (type_ret == -1) { - ret = FAIL; - sprintf( - mess, - "Could not enable/disable veto streaming. Could not open " - "file to know if module attached.\n"); - LOG(logERROR, (mess)); - } else if (type_ret == -2) { - ret = FAIL; - sprintf(mess, "Could not enable/disable veto streaming. No " - "module attached!\n"); - LOG(logERROR, (mess)); - } else if (type_ret == FAIL) { - ret = FAIL; - sprintf(mess, "Could not enable/disable veto streaming. Wrong " - "module type " - "attached!\n"); - LOG(logERROR, (mess)); + if (arg > 0) { + if (checkModuleFlag) { + int type_ret = checkDetectorType(); + if (type_ret == -1) { + ret = FAIL; + sprintf(mess, "Could not enable veto streaming. " + "Could not open " + "file to know if module attached.\n"); + LOG(logERROR, (mess)); + } else if (type_ret == -2) { + ret = FAIL; + sprintf(mess, "Could not enable veto streaming. No " + "module attached!\n"); + LOG(logERROR, (mess)); + } else if (type_ret == FAIL) { + ret = FAIL; + sprintf(mess, "Could not enable veto streaming. Wrong " + "module type " + "attached!\n"); + LOG(logERROR, (mess)); + } + } else { + LOG(logINFOBLUE, + ("In No-Module mode: Ignoring module-attached check. " + "Continuing to enable veto streaming.\n")); } - } else { - LOG(logINFOBLUE, - ("In No-Module mode: Ignoring module-attached check. " - "Continuing to enable/disable veto streaming.\n")); } if (ret == OK) { setVeto(arg);