Skip to content

Commit

Permalink
Add a deprecation warning when using the feature which mounts devices
Browse files Browse the repository at this point in the history
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
  • Loading branch information
brooksdavis committed Feb 10, 2018
1 parent a7e83cc commit ad3a394
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bin/df/df.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit ad3a394

Please sign in to comment.