Fix link to gitweb on the main page.
[paraslash.git] / fd.c
diff --git a/fd.c b/fd.c
index ecd87cdccb555bafea525c3a5ded0063f2b63438..0adab0f2c0732862f03201119f975873211b5c38 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -60,6 +60,24 @@ int para_select(int n, fd_set *readfds, fd_set *writefds,
        return ret;
 }
 
+/**
+ * Set a file descriptor to blocking mode.
+ *
+ * \param fd The file descriptor.
+ *
+ * \return Standard.
+ */
+int mark_fd_blocking(int fd)
+{
+       int flags = fcntl(fd, F_GETFL);
+       if (flags < 0)
+               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;
+}
+
 /**
  * Set a file descriptor to non-blocking mode.
  *
@@ -67,7 +85,7 @@ int para_select(int n, fd_set *readfds, fd_set *writefds,
  *
  * \return Standard.
  */
-int mark_fd_nonblock(int fd)
+int mark_fd_nonblocking(int fd)
 {
        int flags = fcntl(fd, F_GETFL);
        if (flags < 0)