From a3ab8f2a9923b0dc35a0a9f17fd1d69adc5f75d2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 27 Oct 2017 11:14:27 +0200 Subject: [PATCH] hexdcoct: dump to stdout if FILE* is specified as NULL We do a logic like that at various other places, let's do it here too, to make this as little surprising as possible. --- src/basic/hexdecoct.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/basic/hexdecoct.c b/src/basic/hexdecoct.c index dec5552..b61b032 100644 --- a/src/basic/hexdecoct.c +++ b/src/basic/hexdecoct.c @@ -737,7 +737,10 @@ void hexdump(FILE *f, const void *p, size_t s) { const uint8_t *b = p; unsigned n = 0; - assert(s == 0 || b); + assert(b || s == 0); + + if (!f) + f = stdout; while (s > 0) { size_t i; -- 2.7.4