summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2014-10-27 23:37:08 +0000
committerPádraig Brady <P@draigBrady.com>2014-11-23 19:46:38 +0000
commit3ab3c7bb24b86ef2d2fede9fe26e3ee585db5411 (patch)
tree95a0fdd42c59eed6ac815d24c8d1db03d21ded1b /src
parenta78819af2873ea7b104366bf72af7c3e5b30782b (diff)
downloadcoreutils-3ab3c7bb24b86ef2d2fede9fe26e3ee585db5411.tar.xz
df: ensure -a shows all remote file system entries
commit v8.22-125-g9d736f8 printed placeholder "-" values for device names that didn't match the preferred device name for a particular mount point. However that was seen to erroneously suppress values for aliased host names or exports, common with remote file systems. * src/df.c (me_for_dev): Rename from devname_for_dev() so that we can determine the remoteness as well as the name for the preferred mount entry. (get_dev): Don't output place holder values when both current and preferred mount entries are remote. Reported in http://bugs.debian.org/737399
Diffstat (limited to 'src')
-rw-r--r--src/df.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/df.c b/src/df.c
index 5231676da..a52afc4d5 100644
--- a/src/df.c
+++ b/src/df.c
@@ -703,17 +703,17 @@ filter_mount_list (bool devices_only)
}
/* Search a mount entry list for device id DEV.
- Return the corresponding device name if found or NULL if not. */
+ Return the corresponding mount entry if found or NULL if not. */
-static char const * _GL_ATTRIBUTE_PURE
-devname_for_dev (dev_t dev)
+static struct mount_entry const * _GL_ATTRIBUTE_PURE
+me_for_dev (dev_t dev)
{
struct devlist *dl = device_list;
while (dl)
{
if (dl->dev_num == dev)
- return dl->me->me_devname;
+ return dl->me;
dl = dl->next;
}
@@ -928,12 +928,15 @@ get_dev (char const *disk, char const *mount_point, char const* file,
else if (process_all && show_all_fs)
{
/* Ensure we don't output incorrect stats for over-mounted directories.
- Discard stats when the device name doesn't match. */
+ Discard stats when the device name doesn't match. Though don't
+ discard when used and current mount entries are both remote due
+ to the possibility of aliased host names or exports. */
struct stat sb;
if (stat (stat_file, &sb) == 0)
{
- char const * devname = devname_for_dev (sb.st_dev);
- if (devname && ! STREQ (devname, disk))
+ struct mount_entry const * dev_me = me_for_dev (sb.st_dev);
+ if (dev_me && ! STREQ (dev_me->me_devname, disk)
+ && (! dev_me->me_remote || ! me_remote))
{
fstype = "-";
fsu.fsu_blocksize = fsu.fsu_blocks = fsu.fsu_bfree =