if (left > 0) {
/*
- * if the message if longer than the buffers the caller
+ * if the message is longer than the buffers the caller
* requested, we need to consume the rest of the message
* into the pending buffer, where the next readv can
* be served from.
size_t count;
/* the header for message mode */
+ bool hdr_used;
uint8_t hdr[2];
int ret;
switch (npas->file_type) {
case FILE_TYPE_BYTE_MODE_PIPE:
+ state->hdr_used = false;
state->vector = vector;
state->count = count;
break;
new_vector[0].iov_len = sizeof(state->hdr);
memcpy(new_vector + 1, vector, sizeof(struct iovec)*count);
+ state->hdr_used = true;
state->vector = new_vector;
state->count = count + 1;
return;
}
+ /*
+ * in message mode we need to hide the length
+ * of the hdr from the caller
+ */
+ if (state->hdr_used) {
+ ret -= sizeof(state->hdr);
+ }
+
state->ret = ret;
tevent_req_done(req);