aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2021-02-17 15:46:31 -0600
committerRob Landley <rob@landley.net>2021-02-17 15:46:31 -0600
commit9c7085f484dba1e14f47fc05e249c18922b8db5d (patch)
tree8cce0bed2f0e2889a452ad5c81d64ef164533071
parentb26587fb956c4145d67518ea295cd058ef21c4f9 (diff)
downloadtoybox-9c7085f484dba1e14f47fc05e249c18922b8db5d.tar.gz
Teach df /dev/node to reliably show rdev even when devtmpfs is mounted
more recently than the resulting mount point.
-rw-r--r--toys/posix/df.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/toys/posix/df.c b/toys/posix/df.c
index 0201315e..c8f492ea 100644
--- a/toys/posix/df.c
+++ b/toys/posix/df.c
@@ -160,11 +160,11 @@ void df_main(void)
} else {
// Find and display this filesystem. Use _last_ hit in case of
// overmounts (which is first hit in the reversed list).
- for (mt = mtend; mt; mt = mt->prev)
- if (st.st_dev == mt->stat.st_dev
- || (st.st_rdev && (st.st_rdev == mt->stat.st_dev)))
- break;
- show_mt(mt, measuring);
+ for (mt = mtend, mt2 = 0; mt; mt = mt->prev) {
+ if (!mt2 && st.st_dev == mt->stat.st_dev) mt2 = mt;
+ if (st.st_rdev && (st.st_rdev == mt->stat.st_dev)) break;
+ }
+ show_mt(mt ? : mt2, measuring);
}
}
if (!measuring--) break;