From 0e0d3c00bc098e41b82a4073e3d3f5432fb9b0c6 Mon Sep 17 00:00:00 2001 From: George Dunlap Date: Wed, 31 May 2023 17:06:55 +0100 Subject: [PATCH] xentrace: allow xentrace to write to stdout The output file is optional. In case it is missing, xentrace is supposed to write to stdout - unless it is a tty, which is checked prior using it. Signed-off-by: Olaf Hering Acked-by: George Dunlap --- tools/xentrace/xentrace.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c index 864e30d50c..b81abe8a51 100644 --- a/tools/xentrace/xentrace.c +++ b/tools/xentrace/xentrace.c @@ -1152,11 +1152,9 @@ static void parse_args(int argc, char **argv) } } - /* get outfile (required last argument) */ - if (optind != (argc-1)) - usage(); - - opts.outfile = argv[optind]; + /* get outfile (optional last argument) */ + if (argc > optind) + opts.outfile = argv[optind]; } /* *BSD has no O_LARGEFILE */ -- 2.39.5