From ad8d5396323fb6c54527c5cd00a6fe39920678ed Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 10 Feb 2008 14:16:42 +0100 Subject: [PATCH] Get rid of E_MKSTEMP and E_FCHMOD. Use the system errno instead. --- error.h | 2 -- string.c | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/error.h b/error.h index 8ec328e4..da17ff57 100644 --- a/error.h +++ b/error.h @@ -259,8 +259,6 @@ extern const char **para_errlist[]; #define STRING_ERRORS \ - 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"), \ diff --git a/string.c b/string.c index a6019e30..f1f016f3 100644 --- a/string.c +++ b/string.c @@ -260,20 +260,21 @@ __must_check __malloc char *para_tmpname(void) * 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) - return -E_MKSTEMP; + return -ERRNO_TO_PARA_ERROR(errno); tmp = fchmod(fd, mode); if (tmp >= 0) return fd; + tmp = errno; close(fd); unlink(template); - return -E_FCHMOD; + return -ERRNO_TO_PARA_ERROR(tmp); } /** -- 2.39.5