From d3d33000fe90444bece6dc5c4996b6fa23c539e1 Mon Sep 17 00:00:00 2001 From: kris Date: Tue, 8 May 2001 06:58:25 +0000 Subject: 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 --- bin/df/Makefile | 2 -- bin/df/df.c | 36 +----------------------------------- 2 files changed, 1 insertion(+), 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; /* -- cgit v1.1