summaryrefslogtreecommitdiff
path: root/bin/df/df.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/df/df.c')
-rw-r--r--bin/df/df.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/bin/df/df.c b/bin/df/df.c
index 42ce083c06be9..5fbfe723e49be 100644
--- a/bin/df/df.c
+++ b/bin/df/df.c
@@ -47,7 +47,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)df.c 8.9 (Berkeley) 5/8/95";
#else
static const char rcsid[] =
- "$Id: df.c,v 1.19 1997/10/13 09:36:05 joerg Exp $";
+ "$Id: df.c,v 1.18 1997/10/12 13:55:43 joerg Exp $";
#endif
#endif /* not lint */
@@ -85,7 +85,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, "iknt:")) != -1)
@@ -148,25 +148,17 @@ main(argc, argv)
continue;
} else if ((stbuf.st_mode & S_IFMT) == S_IFBLK) {
if ((mntpt = getmntpt(*argv)) == 0) {
+ mntpt = mktemp(strdup("/tmp/df.XXXXXX"));
mdev.fspec = *argv;
- mntpath = strdup("/tmp/df.XXXXXX");
- if (mntpath == NULL) {
- warn("strdup failed");
+ if (mkdir(mntpt, DEFFILEMODE) != 0) {
+ warn("%s", mntpt);
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';
@@ -177,7 +169,6 @@ main(argc, argv)
}
(void)unmount(mntpt, 0);
(void)rmdir(mntpt);
- free(mntpath);
continue;
}
} else