Use mkdtemp(3).
This commit is contained in:
parent
cbb3325e89
commit
3834fcec5c
10
bin/df/df.c
10
bin/df/df.c
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: df.c,v 1.27 1998/07/04 19:44:32 mrg Exp $ */
|
/* $NetBSD: df.c,v 1.28 1998/07/27 16:33:31 mycroft Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1980, 1990, 1993, 1994
|
* Copyright (c) 1980, 1990, 1993, 1994
|
||||||
|
@ -49,7 +49,7 @@ __COPYRIGHT(
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94";
|
static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: df.c,v 1.27 1998/07/04 19:44:32 mrg Exp $");
|
__RCSID("$NetBSD: df.c,v 1.28 1998/07/27 16:33:31 mycroft Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
|
@ -141,12 +141,12 @@ main(argc, argv)
|
||||||
continue;
|
continue;
|
||||||
} else if (S_ISBLK(stbuf.st_mode)) {
|
} else if (S_ISBLK(stbuf.st_mode)) {
|
||||||
if ((mntpt = getmntpt(*argv)) == 0) {
|
if ((mntpt = getmntpt(*argv)) == 0) {
|
||||||
mntpt = mktemp(strdup("/tmp/df.XXXXXX"));
|
mntpt = strdup("/tmp/df.XXXXXX");
|
||||||
mdev.fspec = *argv;
|
if (!mkdtemp(mntpt)) {
|
||||||
if (mkdir(mntpt, DEFFILEMODE) != 0) {
|
|
||||||
warn("%s", mntpt);
|
warn("%s", mntpt);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
mdev.fspec = *argv;
|
||||||
if (mount(MOUNT_FFS, mntpt, MNT_RDONLY,
|
if (mount(MOUNT_FFS, mntpt, MNT_RDONLY,
|
||||||
&mdev) != 0) {
|
&mdev) != 0) {
|
||||||
(void)rmdir(mntpt);
|
(void)rmdir(mntpt);
|
||||||
|
|
Loading…
Reference in New Issue