X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=fd.c;h=0fb796025945b2c33e59c6c8508d370626ac0c02;hp=c3099f2c7c0ef06162ec25044646290f0e014c1e;hb=a4eb244ecdf9aaa0f167b3c91d3e276bde99d681;hpb=a3c27f324e4de20322a90ac9a8625d0d87797ff8 diff --git a/fd.c b/fd.c index c3099f2c..0fb79602 100644 --- a/fd.c +++ b/fd.c @@ -6,6 +6,7 @@ /** \file fd.c Helper functions for file descriptor handling. */ +#include #include #include #include @@ -15,6 +16,7 @@ #include "para.h" #include "error.h" #include "string.h" + /** * Write a buffer to a file descriptor, re-write on short writes. * @@ -419,7 +421,7 @@ out: * \param start The start address of the memory mapping. * \param length The size of the mapping. * - * \return Positive on success, \p -E_MUNMAP on errors. + * \return Standard. * * \sa munmap(2), mmap_full_file(). */ @@ -445,18 +447,14 @@ int para_munmap(void *start, size_t length) int write_ok(int fd) { - struct timeval tv = {0, 0}; + struct timeval tv; fd_set wfds; - int ret; -again: + FD_ZERO(&wfds); FD_SET(fd, &wfds); tv.tv_sec = 0; tv.tv_usec = 0; - ret = select(fd + 1, NULL, &wfds, NULL, &tv); - if (ret < 0 && errno == EINTR) - goto again; - return ret; + return para_select(fd + 1, NULL, &wfds, &tv); } /**