2 * UCW Library -- Careful Read/Write
4 * (c) 2004--2012 Martin Mares <mj@ucw.cz>
5 * (c) 2020 Jan Filip Chadima <jfch@jagda.eu>
7 * This software may be freely distributed and used according to the terms
8 * of the GNU Lesser General Public License.
17 * Reads and writes on sockets and pipes can return partial results,
18 * so we implement an iterated read/write call.
22 careful_read(int fd, void *buf, size_t len)
27 ssize_t l = read(fd, pos, len);
43 careful_write(int fd, const void *buf, size_t len)
45 const byte *pos = buf;
48 ssize_t l = write(fd, pos, len);