summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-10-27 11:14:27 +0200
committerLennart Poettering <lennart@poettering.net>2017-11-17 11:13:44 +0100
commita3ab8f2a9923b0dc35a0a9f17fd1d69adc5f75d2 (patch)
tree986a7d453c813b2323247fda5a10bb1d3693c532 /src
parenthexdecoct: slightly extend the unbase64mem() API and related (diff)
downloadsystemd-a3ab8f2a9923b0dc35a0a9f17fd1d69adc5f75d2.tar.xz
systemd-a3ab8f2a9923b0dc35a0a9f17fd1d69adc5f75d2.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/basic/hexdecoct.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/basic/hexdecoct.c b/src/basic/hexdecoct.c
index dec5552a77..b61b032d99 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;