]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - fd.c
para_select(): Return a proper error code on errors.
[paraslash.git] / fd.c
diff --git a/fd.c b/fd.c
index ed61664545817d51774bdff4d1502a019f8bdfe8..08a06589bc4294fd6c1c8f9f0ca54fdf407a96e8 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -29,21 +29,22 @@ int file_exists(const char *fn)
 }
 
 /**
 }
 
 /**
- * paraslash's wrapper for select(2)
+ * Paraslash's wrapper for select(2).
  *
  * It calls select(2) (with no exceptfds) and starts over if select() was
  * interrupted by a signal.
  *
  *
  * It calls select(2) (with no exceptfds) and starts over if select() was
  * interrupted by a signal.
  *
- * \param n the highest-numbered descriptor in any of the two sets, plus 1
- * \param readfds fds that should be checked for readability
- * \param writefds fds that should be checked for writablility
+ * \param n The highest-numbered descriptor in any of the two sets, plus 1.
+ * \param readfds fds that should be checked for readability.
+ * \param writefds fds that should be checked for writablility.
  * \param timeout_tv upper bound on the amount of time elapsed before select()
  * \param timeout_tv upper bound on the amount of time elapsed before select()
- * returns
+ * returns.
  *
  *
- * \return The return value of the underlying select() call.
+ * \return The return value of the underlying select() call on success, the
+ * negative system error code on errors.
  *
  * All arguments are passed verbatim to select(2).
  *
  * All arguments are passed verbatim to select(2).
- * \sa select(2) select_tut(2)
+ * \sa select(2) select_tut(2).
  */
 int para_select(int n, fd_set *readfds, fd_set *writefds,
                struct timeval *timeout_tv)
  */
 int para_select(int n, fd_set *readfds, fd_set *writefds,
                struct timeval *timeout_tv)
@@ -54,8 +55,7 @@ int para_select(int n, fd_set *readfds, fd_set *writefds,
                err = errno;
        } while (ret < 0 && err == EINTR);
        if (ret < 0)
                err = errno;
        } while (ret < 0 && err == EINTR);
        if (ret < 0)
-               PARA_CRIT_LOG("select error: %s, max_fileno: %d\n",
-                       strerror(err), n);
+               return -ERRNO_TO_PARA_ERROR(errno);
        return ret;
 }
 
        return ret;
 }