From cf5b29e126666413db5eeef96abda82a8e1b2cab Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Wed, 19 Dec 2001 08:38:02 +0000 Subject: [PATCH] Make ``df -l'' work when no network filesystems are loaded. PR: bin/32397 --- bin/df/df.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/df/df.c b/bin/df/df.c index 77c2d28efe7..f244c26f876 100644 --- a/bin/df/df.c +++ b/bin/df/df.c @@ -548,8 +548,10 @@ makenetvfslist() } } - if ((str = malloc(sizeof(char) * (32 * cnt + cnt + 2))) == NULL) { - warnx("malloc failed"); + if (cnt == 0 || + (str = malloc(sizeof(char) * (32 * cnt + cnt + 2))) == NULL) { + if (cnt > 0) + warnx("malloc failed"); free(listptr); return (NULL); }