[git commit] df: do "rootfs" check sooner

Denys Vlasenko vda.linux at googlemail.com
Fri Feb 23 16:08:32 UTC 2018


commit: https://git.busybox.net/busybox/commit/?id=e20a703fd34fa0f3ac17c53d868735a99d794a3e
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
df_main                                             1065    1064      -1

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 coreutils/df.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/coreutils/df.c b/coreutils/df.c
index 1ed09d015..50dccac52 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -206,6 +206,11 @@ int df_main(int argc UNUSED_PARAM, char **argv)
 		}
 
 		device = mount_entry->mnt_fsname;
+
+		/* GNU coreutils 6.10 skips certain mounts, try to be compatible */
+		if (ENABLE_FEATURE_SKIP_ROOTFS && strcmp(device, "rootfs") == 0)
+			continue;
+
 		mount_point = mount_entry->mnt_dir;
 		fs_type = mount_entry->mnt_type;
 
@@ -245,10 +250,6 @@ int df_main(int argc UNUSED_PARAM, char **argv)
 				blocks_percent_used = u / (unsigned)blocks_total;
 			}
 
-			/* GNU coreutils 6.10 skips certain mounts, try to be compatible.  */
-			if (ENABLE_FEATURE_SKIP_ROOTFS && strcmp(device, "rootfs") == 0)
-				continue;
-
 #ifdef WHY_WE_DO_IT_FOR_DEV_ROOT_ONLY
 			if (strcmp(device, "/dev/root") == 0) {
 				/* Adjusts device to be the real root device,


More information about the busybox-cvs mailing list