summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-28 02:07:32 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-28 02:08:40 +0100
commitf02ca52281315cb6067a3798450bc814837c85ef (patch)
tree2e1715c429a1c7a729eb94a6e66d273489f68d9f /src/shared/util.c
parentb6b1849830f5e4a6065c3b0c993668e500c954d3 (diff)
util: treat -1 as special size in format_bytes()
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 92b4d498fe..dfaf7f7f45 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5184,6 +5184,9 @@ char *format_bytes(char *buf, size_t l, off_t t) {
{ "K", 1024ULL },
};
+ if (t == (off_t) -1)
+ return NULL;
+
for (i = 0; i < ELEMENTSOF(table); i++) {
if (t >= table[i].factor) {