diff options
author | kris <kris@FreeBSD.org> | 2001-05-08 06:58:25 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2001-05-08 06:58:25 +0000 |
commit | d3d33000fe90444bece6dc5c4996b6fa23c539e1 (patch) | |
tree | bf2d31754c7d696ea564b4dd41d3d3f339ebfa41 | |
parent | 7c549baa5610873e876e6848b2410f42ac55446b (diff) | |
download | FreeBSD-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
-rw-r--r-- | bin/df/Makefile | 2 | ||||
-rw-r--r-- | bin/df/df.c | 36 |
2 files changed, 1 insertions, 37 deletions
diff --git a/bin/df/Makefile b/bin/df/Makefile index d9a27cf..77a05e84 100644 --- a/bin/df/Makefile +++ b/bin/df/Makefile @@ -3,8 +3,6 @@ PROG= df SRCS= df.c vfslist.c -BINGRP= operator -BINMODE=2555 MOUNT= ${.CURDIR}/../../sbin/mount CFLAGS+= -I${MOUNT} 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; /* |