Blame lib/mkstemp.c

Packit Service fdd496
/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2017 Free Software
Packit Service fdd496
   Foundation, Inc.
Packit Service fdd496
   This file is derived from the one in the GNU C Library.
Packit Service fdd496
Packit Service fdd496
   This program is free software: you can redistribute it and/or modify
Packit Service fdd496
   it under the terms of the GNU General Public License as published by
Packit Service fdd496
   the Free Software Foundation; either version 3 of the License, or
Packit Service fdd496
   (at your option) any later version.
Packit Service fdd496
Packit Service fdd496
   This program is distributed in the hope that it will be useful,
Packit Service fdd496
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service fdd496
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service fdd496
   GNU General Public License for more details.
Packit Service fdd496
Packit Service fdd496
   You should have received a copy of the GNU General Public License
Packit Service fdd496
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit Service fdd496
Packit Service fdd496
#if !_LIBC
Packit Service fdd496
# include <config.h>
Packit Service fdd496
#endif
Packit Service fdd496
Packit Service fdd496
#include <stdlib.h>
Packit Service fdd496
Packit Service fdd496
#if !_LIBC
Packit Service fdd496
# include "tempname.h"
Packit Service fdd496
# define __gen_tempname gen_tempname
Packit Service fdd496
# ifndef __GT_FILE
Packit Service fdd496
#  define __GT_FILE GT_FILE
Packit Service fdd496
# endif
Packit Service fdd496
#endif
Packit Service fdd496
Packit Service fdd496
#include <stdio.h>
Packit Service fdd496
Packit Service fdd496
#ifndef __GT_FILE
Packit Service fdd496
# define __GT_FILE 0
Packit Service fdd496
#endif
Packit Service fdd496
Packit Service fdd496
/* Generate a unique temporary file name from XTEMPLATE.
Packit Service fdd496
   The last six characters of XTEMPLATE must be "XXXXXX";
Packit Service fdd496
   they are replaced with a string that makes the file name unique.
Packit Service fdd496
   Then open the file and return a fd.
Packit Service fdd496
Packit Service fdd496
   If you are creating temporary files which will later be removed,
Packit Service fdd496
   consider using the clean-temp module, which avoids several pitfalls
Packit Service fdd496
   of using mkstemp directly. */
Packit Service fdd496
int
Packit Service fdd496
mkstemp (char *xtemplate)
Packit Service fdd496
{
Packit Service fdd496
  return __gen_tempname (xtemplate, 0, 0, __GT_FILE);
Packit Service fdd496
}