mirror of
https://github.com/samba-team/samba.git
synced 2024-12-31 17:18:04 +03:00
Convert read_packet_remainder to use read_socket_with_timeout_ntstatus
This commit is contained in:
parent
5750c3a51b
commit
fff31f8f35
@ -148,22 +148,34 @@ static ssize_t read_packet_remainder(int fd,
|
|||||||
unsigned int timeout,
|
unsigned int timeout,
|
||||||
ssize_t len)
|
ssize_t len)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
NTSTATUS status;
|
||||||
|
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = read_socket_with_timeout(fd, buffer, len, len, timeout,
|
set_smb_read_error(get_srv_read_error(), SMB_READ_OK);
|
||||||
get_srv_read_error());
|
|
||||||
|
|
||||||
if (ret != len) {
|
status = read_socket_with_timeout_ntstatus(fd, buffer, len, len,
|
||||||
cond_set_smb_read_error(get_srv_read_error(),
|
timeout, NULL);
|
||||||
SMB_READ_ERROR);
|
|
||||||
|
if (NT_STATUS_IS_OK(status)) {
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
|
||||||
|
set_smb_read_error(get_srv_read_error(), SMB_READ_EOF);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return len;
|
if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
|
||||||
|
set_smb_read_error(get_srv_read_error(),
|
||||||
|
SMB_READ_TIMEOUT);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_smb_read_error(get_srv_read_error(), SMB_READ_ERROR);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user