Use mkdtemp(3).

This commit is contained in:
mycroft 1998-07-27 16:33:31 +00:00
parent cbb3325e89
commit 3834fcec5c
1 changed files with 5 additions and 5 deletions

View File

@ -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
@ -49,7 +49,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94";
#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 /* not lint */
@ -141,12 +141,12 @@ main(argc, argv)
continue;
} else if (S_ISBLK(stbuf.st_mode)) {
if ((mntpt = getmntpt(*argv)) == 0) {
mntpt = mktemp(strdup("/tmp/df.XXXXXX"));
mdev.fspec = *argv;
if (mkdir(mntpt, DEFFILEMODE) != 0) {
mntpt = strdup("/tmp/df.XXXXXX");
if (!mkdtemp(mntpt)) {
warn("%s", mntpt);
continue;
}
mdev.fspec = *argv;
if (mount(MOUNT_FFS, mntpt, MNT_RDONLY,
&mdev) != 0) {
(void)rmdir(mntpt);