From 01b808c6fba9d733342e7a01913855c2ddff5a91 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Tue, 10 Jun 2014 15:28:10 +0200 Subject: [PATCH] df(1): Fix field widths for iused and ifree when df -hi is used. Submitted-by: Robin Hahling --- 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 a930642cea..91f5be7c08 100644 --- a/bin/df/df.c +++ b/bin/df/df.c @@ -404,8 +404,10 @@ prtstat(struct statfs *sfsp, struct statvfs *vsfsp, struct maxwidths *mwp) printf(" %-*s %*s %*s Capacity", mwp->total, header, mwp->used, "Used", mwp->avail, "Avail"); if (iflag) { - mwp->iused = imax(mwp->iused, strlen(" iused")); - mwp->ifree = imax(mwp->ifree, strlen("ifree")); + mwp->iused = imax(hflag ? 0 : mwp->iused, + (int)strlen(" iused")); + mwp->ifree = imax(hflag ? 0 : mwp->ifree, + (int)strlen("ifree")); printf(" %*s %*s %%iused", mwp->iused - 2, "iused", mwp->ifree, "ifree"); } -- 2.41.0