If there is unprocessed data in the input buffer (ilen > 0), place new
data read after the unprocessed one.
Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
space_to_read = sizeof(buf_in) - ilen;
/* Read the next chunk from the file. */
- nread = read(fd, buf_in, space_to_read);
+ nread = read(fd, buf_in + ilen, space_to_read);
if (nread < 0) {
DBG_ERR("read failed: %s\n", strerror(errno));
ret = -1;