summaryrefslogtreecommitdiffstats
path: root/bin/df
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2001-12-19 08:38:02 +0000
committerru <ru@FreeBSD.org>2001-12-19 08:38:02 +0000
commit3145320d5808fab2aaa4d0dd7999119aeb51d3ae (patch)
treef805da797b391bc57f44ca244c965218627f4241 /bin/df
parentd0b486460fe9e2066e22687a79cbb8620e86db31 (diff)
downloadFreeBSD-src-3145320d5808fab2aaa4d0dd7999119aeb51d3ae.zip
FreeBSD-src-3145320d5808fab2aaa4d0dd7999119aeb51d3ae.tar.gz
Make ``df -l'' work when no network filesystems are loaded.
PR: bin/32397
Diffstat (limited to 'bin/df')
-rw-r--r--bin/df/df.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/df/df.c b/bin/df/df.c
index 77c2d28..f244c26 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);
}
OpenPOWER on IntegriCloud