]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Get rid of E_MKSTEMP and E_FCHMOD.
authorAndre Noll <maan@systemlinux.org>
Sun, 10 Feb 2008 13:16:42 +0000 (14:16 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 10 Feb 2008 13:16:42 +0000 (14:16 +0100)
Use the system errno instead.

error.h
string.c

diff --git a/error.h b/error.h
index 8ec328e4c57bb6d95c432dc96731244c5cc1e3bd..da17ff57922adfcf2b28eeb5dd820ba708779ee2 100644 (file)
--- a/error.h
+++ b/error.h
@@ -259,8 +259,6 @@ extern const char **para_errlist[];
 
 
 #define STRING_ERRORS \
 
 
 #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"), \
        PARA_ERROR(ATOI_OVERFLOW, "value too large"), \
        PARA_ERROR(STRTOLL, "unknown strtoll error"), \
        PARA_ERROR(ATOI_NO_DIGITS, "no digits found in string"), \
index a6019e30cee2d71f0825e4eae2970b7209d9d74e..f1f016f331bd81201f3534ecbb02041acd9919ba 100644 (file)
--- 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.
  * 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 -E_MKSTEMP;
+               return -ERRNO_TO_PARA_ERROR(errno);
        tmp = fchmod(fd, mode);
        if (tmp >= 0)
                return fd;
        tmp = fchmod(fd, mode);
        if (tmp >= 0)
                return fd;
+       tmp = errno;
        close(fd);
        unlink(template);
        close(fd);
        unlink(template);
-       return -E_FCHMOD;
+       return -ERRNO_TO_PARA_ERROR(tmp);
 }
 
 /**
 }
 
 /**