Skip to content

Commit 345473f

Browse files
en-scborneoa
authored andcommitted
helper/options: handle errors in -l
Before the patch an error in opening the log file (e.g. can't write a file) was ignored when specified via `-l`. E.g.: ``` > touch log > chmod -w log > openocd -l log -c shutdown ... failed to open output log "log" shutdown command invoked > echo $? 0 ``` After the patch: ``` ... > openocd -l log -c shutdown ... failed to open output log "log" > echo $? 1 ``` Change-Id: Ibab45f580dc46a499bf967c4afad071f9c2972a2 Signed-off-by: Evgeniy Naydanov <[email protected]> Reviewed-on: https://review.openocd.org/c/openocd/+/8666 Tested-by: jenkins Reviewed-by: Antonio Borneo <[email protected]>
1 parent 778d2dc commit 345473f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/helper/options.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,12 @@ int parse_cmdline_args(struct command_context *cmd_ctx, int argc, char *argv[])
303303
break;
304304
}
305305
case 'l': /* --log_output | -l */
306-
command_run_linef(cmd_ctx, "log_output %s", optarg);
306+
{
307+
int retval = command_run_linef(cmd_ctx, "log_output %s", optarg);
308+
if (retval != ERROR_OK)
309+
return retval;
307310
break;
311+
}
308312
case 'c': /* --command | -c */
309313
add_config_command(optarg);
310314
break;

0 commit comments

Comments
 (0)