diff options
| author | Volker Lendecke <vl@samba.org> | 2015-02-16 14:35:03 +0000 |
|---|---|---|
| committer | Jeremy Allison <jra@samba.org> | 2015-02-24 17:52:09 +0100 |
| commit | ce9ae131fe66c82448e2f82dbc0b103aecc851b6 (patch) | |
| tree | fb0e8aab80e363e8abfa2453246f360f6a9759bf /source3 | |
| parent | 1c2562e691937b6e877189477f18a735210ec5f5 (diff) | |
| download | samba-ce9ae131fe66c82448e2f82dbc0b103aecc851b6.tar.gz samba-ce9ae131fe66c82448e2f82dbc0b103aecc851b6.tar.xz samba-ce9ae131fe66c82448e2f82dbc0b103aecc851b6.zip | |
smb2_server: Use iov_advance
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
| -rw-r--r-- | source3/smbd/smb2_server.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 5c1fa98e53..432b866531 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -3173,6 +3173,7 @@ static NTSTATUS smbd_smb2_flush_send_queue(struct smbXsrv_connection *xconn) while (xconn->smb2.send_queue != NULL) { struct smbd_smb2_send_queue *e = xconn->smb2.send_queue; + bool ok; if (e->sendfile_header != NULL) { NTSTATUS status = NT_STATUS_INTERNAL_ERROR; @@ -3234,31 +3235,10 @@ static NTSTATUS smbd_smb2_flush_send_queue(struct smbXsrv_connection *xconn) if (err != 0) { return map_nt_error_from_unix_common(err); } - while (ret > 0) { - if (ret < e->vector[0].iov_len) { - uint8_t *base; - base = (uint8_t *)e->vector[0].iov_base; - base += ret; - e->vector[0].iov_base = (void *)base; - e->vector[0].iov_len -= ret; - break; - } - ret -= e->vector[0].iov_len; - e->vector += 1; - e->count -= 1; - } - /* - * there're maybe some empty vectors at the end - * which we need to skip, otherwise we would get - * ret == 0 from the readv() call and return EPIPE - */ - while (e->count > 0) { - if (e->vector[0].iov_len > 0) { - break; - } - e->vector += 1; - e->count -= 1; + ok = iov_advance(&e->vector, &e->count, ret); + if (!ok) { + return NT_STATUS_INTERNAL_ERROR; } if (e->count > 0) { |
