diff mbox series

[v1,1/3] xentrace: allow xentrace to write to stdout

Message ID 20230526072916.7424-2-olaf@aepfle.de (mailing list archive)
State Superseded
Headers show
Series xentrace changes | expand

Commit Message

Olaf Hering May 26, 2023, 7:29 a.m. UTC
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 <olaf@aepfle.de>
---
 tools/xentrace/xentrace.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

George Dunlap May 26, 2023, 10:04 a.m. UTC | #1
On Fri, May 26, 2023 at 8:29 AM Olaf Hering <olaf@aepfle.de> wrote:

> 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 <olaf@aepfle.de>
>

Acked-by: George Dunlap <george.dunlap@cloud.com>
diff mbox series

Patch

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 */