1*0a6a1f1dSLionel Sambuc /* $NetBSD: mktemp.c,v 1.21 2014/06/18 17:47:58 christos Exp $ */
22fe8fb19SBen Gras
3b7061124SArun Thomas /*
4b7061124SArun Thomas * Copyright (c) 1987, 1993
5b7061124SArun Thomas * The Regents of the University of California. All rights reserved.
6b7061124SArun Thomas *
7b7061124SArun Thomas * Redistribution and use in source and binary forms, with or without
8b7061124SArun Thomas * modification, are permitted provided that the following conditions
9b7061124SArun Thomas * are met:
10b7061124SArun Thomas * 1. Redistributions of source code must retain the above copyright
11b7061124SArun Thomas * notice, this list of conditions and the following disclaimer.
12b7061124SArun Thomas * 2. Redistributions in binary form must reproduce the above copyright
13b7061124SArun Thomas * notice, this list of conditions and the following disclaimer in the
14b7061124SArun Thomas * documentation and/or other materials provided with the distribution.
152fe8fb19SBen Gras * 3. Neither the name of the University nor the names of its contributors
16b7061124SArun Thomas * may be used to endorse or promote products derived from this software
17b7061124SArun Thomas * without specific prior written permission.
18b7061124SArun Thomas *
19b7061124SArun Thomas * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20b7061124SArun Thomas * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21b7061124SArun Thomas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22b7061124SArun Thomas * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23b7061124SArun Thomas * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24b7061124SArun Thomas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25b7061124SArun Thomas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26b7061124SArun Thomas * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27b7061124SArun Thomas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28b7061124SArun Thomas * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29b7061124SArun Thomas * SUCH DAMAGE.
30b7061124SArun Thomas */
31*0a6a1f1dSLionel Sambuc #include "gettemp.h"
32b7061124SArun Thomas
332fe8fb19SBen Gras #include <sys/cdefs.h>
34b7061124SArun Thomas #if defined(LIBC_SCCS) && !defined(lint)
352fe8fb19SBen Gras #if 0
36b7061124SArun Thomas static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
372fe8fb19SBen Gras #else
38*0a6a1f1dSLionel Sambuc __RCSID("$NetBSD: mktemp.c,v 1.21 2014/06/18 17:47:58 christos Exp $");
392fe8fb19SBen Gras #endif
40b7061124SArun Thomas #endif /* LIBC_SCCS and not lint */
41b7061124SArun Thomas
422fe8fb19SBen Gras #include "local.h"
43b7061124SArun Thomas
442fe8fb19SBen Gras char *
_mktemp(char * path)45f14fb602SLionel Sambuc _mktemp(char *path)
46b7061124SArun Thomas {
47b7061124SArun Thomas
482fe8fb19SBen Gras _DIAGASSERT(path != NULL);
492fe8fb19SBen Gras
50*0a6a1f1dSLionel Sambuc return GETTEMP(path, NULL, 0, 0, 0) ? path : NULL;
51b7061124SArun Thomas }
52b7061124SArun Thomas
532fe8fb19SBen Gras __warn_references(mktemp,
542fe8fb19SBen Gras "warning: mktemp() possibly used unsafely, use mkstemp() or mkdtemp()")
552fe8fb19SBen Gras
56b7061124SArun Thomas char *
mktemp(char * path)57f14fb602SLionel Sambuc mktemp(char *path)
58b7061124SArun Thomas {
598a0c10fcSBen Gras
602fe8fb19SBen Gras _DIAGASSERT(path != NULL);
61b7061124SArun Thomas
62*0a6a1f1dSLionel Sambuc return GETTEMP(path, NULL, 0, 0, 0) ? path : NULL;
63b7061124SArun Thomas }
64