--- libaitio/src/aio.c 2010/07/05 11:01:56 1.1.2.2 +++ libaitio/src/aio.c 2010/07/05 12:02:47 1.1.2.3 @@ -15,6 +15,7 @@ io_rread(int fd, void * __restrict buf, size_t nbytes, { int ret; #ifdef AIO_OPS + off_t old = 0; struct aiocb acb; #endif @@ -34,8 +35,14 @@ io_rread(int fd, void * __restrict buf, size_t nbytes, #ifdef AIO_OPS /* This made for generate EOF for file */ - if (update && offset >= lseek(fd, 0, SEEK_END)) + if (!update && (old = lseek(fd, 0, SEEK_CUR)) == -1) { + LOGERR; + return -1; + } + if (offset >= lseek(fd, 0, SEEK_END)) return 0; + if (!update) + lseek(fd, old, SEEK_SET); memset(buf, 0, nbytes); memset(&acb, 0, sizeof acb);