aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2018-02-10 00:22:25 +0000
committerBrooks Davis <brooks@FreeBSD.org>2018-02-10 00:22:25 +0000
commite3e94324785a31587cff84c5f4ab8a06d18f9bc0 (patch)
tree1e5239f770d74d1b1a426cb3c5f85819f6fcda54 /bin
parentbc55f7298ef501dc22e8ca3309cb04dff54594ef (diff)
downloadsrc-e3e94324785a31587cff84c5f4ab8a06d18f9bc0.tar.gz
src-e3e94324785a31587cff84c5f4ab8a06d18f9bc0.zip
Add a deprecation warning when using the feature which mounts devices
to see how much space it on them. Adjust MOUNT_CHAR_DEVS to allow the free space of already mounted devices to be displayed and report an appropriate error if the device isn't mounted. Reviewed by: cem MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8801
Notes
Notes: svn path=/head/; revision=329092
Diffstat (limited to 'bin')
-rw-r--r--bin/df/df.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/df/df.c b/bin/df/df.c
index 00f782f2c92f..ed7d319388cf 100644
--- a/bin/df/df.c
+++ b/bin/df/df.c
@@ -254,9 +254,11 @@ main(int argc, char *argv[])
rv = 1;
continue;
}
-#ifdef MOUNT_CHAR_DEVS
} else if (S_ISCHR(stbuf.st_mode)) {
if ((mntpt = getmntpt(*argv)) == NULL) {
+#ifdef MOUNT_CHAR_DEVS
+ xo_warnx(
+ "df on unmounted devices is deprecated");
mdev.fspec = *argv;
mntpath = strdup("/tmp/df.XXXXXX");
if (mntpath == NULL) {
@@ -305,8 +307,12 @@ main(int argc, char *argv[])
(void)rmdir(mntpt);
free(mntpath);
continue;
- }
+#else
+ xo_warnx("%s: not mounted", *argv);
+ rv = 1;
+ continue;
#endif
+ }
} else
mntpt = *argv;