From 43a46e252c6b098693dc52ed0972fb4108527d5d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 12 Mar 2020 10:26:01 +1030 Subject: [PATCH] devtools/onion: allow '-' input file so you can pipe from stdin. This avoid the requirement to use a temporary file. Signed-off-by: Rusty Russell --- devtools/onion.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/devtools/onion.c b/devtools/onion.c index e9e13ef01..56715f64b 100644 --- a/devtools/onion.c +++ b/devtools/onion.c @@ -145,7 +145,8 @@ static void do_decode(int argc, char **argv, const u8 assocdata[ASSOC_DATA_SIZE] if (argc != 4) opt_usage_exit_fail("Expect an filename and privkey with 'decode' method"); - char *hextemp = grab_file(ctx, argv[2]); + /* "-" means stdin, which is NULL for grab_file */ + char *hextemp = grab_file(ctx, streq(argv[2], "-") ? NULL : argv[2]); size_t hexlen = strlen(hextemp); // trim trailing whitespace