summaryrefslogtreecommitdiffstats
path: root/bin/df/df.c
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2001-05-08 06:58:25 +0000
committerkris <kris@FreeBSD.org>2001-05-08 06:58:25 +0000
commitd3d33000fe90444bece6dc5c4996b6fa23c539e1 (patch)
treebf2d31754c7d696ea564b4dd41d3d3f339ebfa41 /bin/df/df.c
parent7c549baa5610873e876e6848b2410f42ac55446b (diff)
downloadFreeBSD-src-d3d33000fe90444bece6dc5c4996b6fa23c539e1.zip
FreeBSD-src-d3d33000fe90444bece6dc5c4996b6fa23c539e1.tar.gz
GC some dead code relating to running df on unmounted block devices,
and remove the setgid operator bit from the installed binary: if you want to view free disk space on an unmounted device, you should have read permissions to access it. Reviewed by: phk
Diffstat (limited to 'bin/df/df.c')
-rw-r--r--bin/df/df.c36
1 files changed, 1 insertions, 35 deletions
diff --git a/bin/df/df.c b/bin/df/df.c
index fc8cb34..e7ab41f 100644
--- a/bin/df/df.c
+++ b/bin/df/df.c
@@ -119,7 +119,7 @@ main(argc, argv)
struct statfs statfsbuf, *mntbuf;
long mntsize;
int ch, err, i, maxwidth, rv, width;
- char *mntpt, *mntpath, **vfslist;
+ char *mntpt, **vfslist;
vfslist = NULL;
while ((ch = getopt(argc, argv, "abgHhikmnPt:")) != -1)
@@ -208,40 +208,6 @@ main(argc, argv)
} else if ((stbuf.st_mode & S_IFMT) == S_IFCHR) {
rv = ufs_df(*argv, maxwidth) || rv;
continue;
- } else if ((stbuf.st_mode & S_IFMT) == S_IFBLK) {
- if ((mntpt = getmntpt(*argv)) == 0) {
- mdev.fspec = *argv;
- mntpath = strdup("/tmp/df.XXXXXX");
- if (mntpath == NULL) {
- warn("strdup failed");
- rv = 1;
- continue;
- }
- mntpt = mkdtemp(mntpath);
- if (mntpt == NULL) {
- warn("mkdtemp(\"%s\") failed", mntpath);
- rv = 1;
- free(mntpath);
- continue;
- }
- if (mount("ufs", mntpt, MNT_RDONLY,
- &mdev) != 0) {
- rv = ufs_df(*argv, maxwidth) || rv;
- (void)rmdir(mntpt);
- free(mntpath);
- continue;
- } else if (statfs(mntpt, &statfsbuf) == 0) {
- statfsbuf.f_mntonname[0] = '\0';
- prtstat(&statfsbuf, maxwidth);
- } else {
- warn("%s", *argv);
- rv = 1;
- }
- (void)unmount(mntpt, 0);
- (void)rmdir(mntpt);
- free(mntpath);
- continue;
- }
} else
mntpt = *argv;
/*
OpenPOWER on IntegriCloud