len = MIN(SIZE_LEFT(buf), 4096);
len = SIZE_LEFT(buf);
cvs_buf_load(const char *path, u_int flags){	int fd;	ssize_t ret;	size_t len;	u_char *bp;	struct stat st;	BUF *buf;	fd = open(path, O_RDONLY, 0600);	if (fd == -1) {		cvs_log(LP_ERRNO, "failed to open buffer source");		return (NULL);	}	if (fstat(fd, &st) == -1) {		cvs_log(LP_ERRNO, "failed to stat buffer source");		(void)close(fd);		return (NULL);	}	buf = cvs_buf_alloc((size_t)st.st_size, flags);	if (buf == NULL) {		(void)close(fd);		return (NULL);	}	for (bp = buf->cb_cur; ; bp += (size_t)ret) {		len = MIN(SIZE_LEFT(buf), 4096);		ret = read(fd, bp, len);		if (ret == -1) {			cvs_log(LP_ERRNO, "read failed from buffer source");			(void)close(fd);			cvs_buf_free(buf);			return (NULL);		} else if (ret == 0)			break;		buf->cb_len += (size_t)ret;	}	(void)close(fd);	return (buf);}