]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Get rid of -E_F_GETFL and -E_F_SETFL.
authorAndre Noll <maan@systemlinux.org>
Tue, 9 Oct 2007 18:10:22 +0000 (20:10 +0200)
committerAndre Noll <maan@systemlinux.org>
Tue, 9 Oct 2007 18:10:22 +0000 (20:10 +0200)
Return the proper errno instead, using the new ERRNO_TO_PARA_ERROR macro..

error.h
fd.c

diff --git a/error.h b/error.h
index 2d03585a953f811c5d85cc1cea0cb474a18589c3..62540f4fcf78ba0a086390859077e2f74e8fba0c 100644 (file)
--- a/error.h
+++ b/error.h
@@ -409,8 +409,6 @@ extern const char **para_errlist[];
 
 #define FD_ERRORS \
        PARA_ERROR(NOTDIR, "error: not a directory"), \
 
 #define FD_ERRORS \
        PARA_ERROR(NOTDIR, "error: not a directory"), \
-       PARA_ERROR(F_GETFL, "failed to get fd flags"), \
-       PARA_ERROR(F_SETFL, "failed to set fd flags"), \
        PARA_ERROR(FGETS, "fgets error"), \
        PARA_ERROR(EXIST, "file or directory already exists"), \
        PARA_ERROR(ISDIR, "error: is a directory"), \
        PARA_ERROR(FGETS, "fgets error"), \
        PARA_ERROR(EXIST, "file or directory already exists"), \
        PARA_ERROR(ISDIR, "error: is a directory"), \
diff --git a/fd.c b/fd.c
index e5aa59f59382967ffd9c54e7c7a4199246bde1f1..6bd21b5bda7411d7f4444e1c985a5c661ccadec2 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -60,19 +60,20 @@ int para_select(int n, fd_set *readfds, fd_set *writefds,
 }
 
 /**
 }
 
 /**
- * set a file descriptor to non-blocking mode
+ * Set a file descriptor to non-blocking mode.
  *
  *
- * \param fd The file descriptor
+ * \param fd The file descriptor.
  *
  *
- * \returns 1 on success, -E_F_GETFL, -E_F_SETFL, on errors.
+ * \return Standard.
  */
 int mark_fd_nonblock(int fd)
 {
        int flags = fcntl(fd, F_GETFL);
        if (flags < 0)
  */
 int mark_fd_nonblock(int fd)
 {
        int flags = fcntl(fd, F_GETFL);
        if (flags < 0)
-               return -E_F_GETFL;
-       if (fcntl(fd, F_SETFL, ((long)flags) | O_NONBLOCK) < 0)
-               return -E_F_SETFL;
+               return -ERRNO_TO_PARA_ERROR(errno);
+       flags = fcntl(fd, F_SETFL, ((long)flags) | O_NONBLOCK);
+       if (flags < 0)
+               return -ERRNO_TO_PARA_ERROR(errno);
        return 1;
 }
 
        return 1;
 }