From da3ee4fef608e0d75bd5e521b66b3fb2be919e1b Mon Sep 17 00:00:00 2001 From: Jacqueline Garrahan Date: Tue, 14 Jul 2026 15:23:08 -0700 Subject: [PATCH] iocsh: fix inverted parse test in 'on error wait ' epicsParseDouble returns 0 on success and non-zero on failure, but the branches were swapped: a valid delay printed "Invalid 'on error wait' delay" and the usage text, while an invalid delay was silently accepted with timeout forced to 5.0. Report the error on parse failure and accept the value on success. Co-Authored-By: Claude Opus 4.8 (1M context) --- modules/libcom/src/iocsh/iocsh.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/libcom/src/iocsh/iocsh.cpp b/modules/libcom/src/iocsh/iocsh.cpp index ec3fabddb..580226972 100644 --- a/modules/libcom/src/iocsh/iocsh.cpp +++ b/modules/libcom/src/iocsh/iocsh.cpp @@ -1563,13 +1563,14 @@ static void onCallFunc(const iocshArgBuf *args) USAGE(); } else if (epicsParseDouble(args->aval.av[3], &context->scope->timeout, NULL)) { - context->scope->timeout = 5.0; - } else { + /* epicsParseDouble returns non-zero on failure */ USAGE(); fprintf(epicsGetStderr(), ANSI_RED("Invalid 'on error wait' delay '%s'.") "\n", args->aval.av[3]); + context->scope->timeout = 5.0; } + /* else parse succeeded and timeout has been set */ } else { USAGE();