libowfat/io/io_tryreadtimeout.c
leitner 543987da58 remove superfluous #includes
make it possibly to specify that a buffer should be freed
2003-10-31 23:34:40 +00:00

17 lines
333 B
C

#include <errno.h>
#include "io_internal.h"
int64 io_tryreadtimeout(int64 d,char* buf,int64 len) {
int64 r=io_tryread(d,buf,len);
if (r==-1) {
tai6464 x;
io_entry* e=array_get(&io_fds,sizeof(io_entry),d);
taia_now(&x);
if (!taia_less(&x,&e->timeout)) {
errno=ETIMEDOUT;
r=-2;
}
}
return r;
}