-/**
- * Create unique temporary file.
- *
- * \param template The template to be passed to mkstemp().
- * \param mode The desired mode of the tempfile.
- *
- * This wrapper for mkstemp additionally uses fchmod() to
- * set the given mode of the tempfile if mkstemp() returned success.
- *
- * \return The file descriptor of the temp file just created on success.
- * On errors, a negative value is returned.
- */
-__must_check int para_mkstemp(char *template, mode_t mode)
-{
- int tmp, fd = mkstemp(template);
-
- if (fd < 0)
- return -ERRNO_TO_PARA_ERROR(errno);
- tmp = fchmod(fd, mode);
- if (tmp >= 0)
- return fd;
- tmp = errno;
- close(fd);
- unlink(template);
- return -ERRNO_TO_PARA_ERROR(tmp);
-}
-