Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Feb 2018 00:22:25 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329092 - head/bin/df
Message-ID:  <201802100022.w1A0MP7h082453@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Sat Feb 10 00:22:25 2018
New Revision: 329092
URL: https://svnweb.freebsd.org/changeset/base/329092

Log:
  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

Modified:
  head/bin/df/df.c

Modified: head/bin/df/df.c
==============================================================================
--- head/bin/df/df.c	Fri Feb  9 23:29:50 2018	(r329091)
+++ head/bin/df/df.c	Sat Feb 10 00:22:25 2018	(r329092)
@@ -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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802100022.w1A0MP7h082453>