Use the system errno instead.
- PARA_ERROR(MKSTEMP, "mkstemp error: unable to create tmp file"), \
- PARA_ERROR(FCHMOD, "fchmod error: can not set mode"), \
PARA_ERROR(ATOI_OVERFLOW, "value too large"), \
PARA_ERROR(STRTOLL, "unknown strtoll error"), \
PARA_ERROR(ATOI_NO_DIGITS, "no digits found in string"), \
PARA_ERROR(ATOI_OVERFLOW, "value too large"), \
PARA_ERROR(STRTOLL, "unknown strtoll error"), \
PARA_ERROR(ATOI_NO_DIGITS, "no digits found in string"), \
* set the given mode of the tempfile if mkstemp() returned success.
*
* \return The file descriptor of the temp file just created on success.
* 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.
+ * 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)
*/
__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 = fchmod(fd, mode);
if (tmp >= 0)
return fd;
close(fd);
unlink(template);
close(fd);
unlink(template);
+ return -ERRNO_TO_PARA_ERROR(tmp);