iocsh: fix inverted parse test in 'on error wait <delay>'

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) <noreply@anthropic.com>
This commit is contained in:
Jacqueline GarrahanandClaude Opus 4.8 authored and mdavidsaver committed 2026-07-20 17:24:44 -05:00
1 parent 9cd87f21aa
commit 50f4eaa9c0
1 file changed
+3 -2
+3 -2
View File
@@ -1559,13 +1559,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();