diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-10-27 11:14:27 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-10-27 11:14:27 +0200 |
commit | 49505552890aed8efee7f4c109d874520f2d0d29 (patch) | |
tree | 14f7b3052d3a3d7de85257045ce248e10a9d0e29 /src | |
parent | fcb1a7501411be060c47d18264809d249d3db27d (diff) |
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.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/basic/hexdecoct.c b/src/basic/hexdecoct.c index dec5552a7..b61b032d9 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; |