Mercurial > dovecot > original-hg > dovecot-1.2
view src/lib/read-full.c @ 9191:b340ecb24469 HEAD
Fix VPATH build of RQUOTA support.
Some rpcgen derive #include "..." paths from the infile argument.
This will be off for VPATH builds, as the generated rquota_xdr.c
code will look in $(srcdir), but we'll generate the rquota.h file in
$(builddir). Play safe and copy rquota.x to $(builddir) first.
This fixes the build on openSUSE 11.1.
author | Matthias Andree <matthias.andree@gmx.de> |
---|---|
date | Tue, 07 Jul 2009 21:01:36 +0200 |
parents | b9faf4db2a9f |
children | 00cd9aacd03c |
line wrap: on
line source
/* Copyright (c) 2003-2009 Dovecot authors, see the included COPYING file */ #include "lib.h" #include "read-full.h" #include <unistd.h> int read_full(int fd, void *data, size_t size) { ssize_t ret; while (size > 0) { ret = read(fd, data, size < SSIZE_T_MAX ? size : SSIZE_T_MAX); if (ret <= 0) return ret; data = PTR_OFFSET(data, ret); size -= ret; } return 1; } int pread_full(int fd, void *data, size_t size, off_t offset) { ssize_t ret; while (size > 0) { ret = pread(fd, data, size < SSIZE_T_MAX ? size : SSIZE_T_MAX, offset); if (ret <= 0) return ret; data = PTR_OFFSET(data, ret); size -= ret; offset += ret; } return 1; }