- * \return a pointer to a random filename.
- */
-__must_check __malloc char *para_tmpname(void)
-{
- struct timeval now;
- unsigned int seed;
-
- gettimeofday(&now, NULL);
- seed = now.tv_usec;
- srand(seed);
- return make_message("%08i", rand());
-}
-
-/**
- * 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, -E_MKSTEMP or -E_FCHMOD is returned.
- */
-__must_check int para_mkstemp(char *template, mode_t mode)
-{
- int tmp, fd = mkstemp(template);
-
- if (fd < 0)
- return -E_MKSTEMP;
- tmp = fchmod(fd, mode);
- if (tmp >= 0)
- return fd;
- close(fd);
- unlink(template);
- return -E_FCHMOD;
-}
-
-/**
- * get the logname of the current user
- *
- * \return A dynammically allocated string that must be freed by the caller. On
- * errors, the string "unknown user" is returned, i.e. this function never
- * returns NULL.
- *
- * \sa getpwuid(3)