s/qmail  3.3.23
Next generation secure email transport
timeoutwrite.c
Go to the documentation of this file.
1 #include "timeoutwrite.h"
2 #include "select.h"
3 #include "error.h"
4 #include "readwrite.h"
5 
6 int timeoutwrite(int t,int fd,char *buf,int len)
7 {
8  fd_set wfds;
9  struct timeval tv;
10 
11  tv.tv_sec = t;
12  tv.tv_usec = 0;
13 
14  FD_ZERO(&wfds);
15  FD_SET(fd,&wfds);
16 
17  if (select(fd + 1,(fd_set *) 0,&wfds,(fd_set *) 0,&tv) == -1) return -1;
18  if (FD_ISSET(fd,&wfds)) return write(fd,buf,len);
19 
21  return -1;
22 }
int fd
Definition: idedit.c:16
int timeoutwrite(int t, int fd, char *buf, int len)
Definition: timeoutwrite.c:6
unsigned len
Definition: matchup.c:36
int errno
unsigned char * buf
Definition: dns.c:41
int error_timeout
Definition: error.c:48