summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1f5c634)
this makes sure that the write never blocks.
}
if (FD_ISSET(fd, &w_fds)) {
}
if (FD_ISSET(fd, &w_fds)) {
- int n = len-total;
- int ret = write(fd,buf+total,n?n:1);
+ int ret, n = len-total;
+
+ if (n > PIPE_BUF) n = PIPE_BUF;
+
+ ret = write(fd,buf+total,n?n:1);
if (ret == -1 && errno == EINTR) {
continue;
if (ret == -1 && errno == EINTR) {
continue;
#define MAXPATHLEN 1024
#endif
#define MAXPATHLEN 1024
#endif
+#ifndef PIPE_BUF
+#define PIPE_BUF 512
+#endif
+
#ifndef INADDR_NONE
#define INADDR_NONE 0xffffffff
#endif
#ifndef INADDR_NONE
#define INADDR_NONE 0xffffffff
#endif