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.
18 * Reads and writes on sockets and pipes can return partial results,
19 * so we implement an iterated read/write call.
23 careful_read(int fd, void *buf, size_t len)
28 ssize_t l = read(fd, pos, len);
44 careful_write(int fd, const void *buf, size_t len)
46 const byte *pos = buf;
49 ssize_t l = write(fd, pos, len);