summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-01-25 22:21:38 +0100
committerVolker Lendecke <vl@samba.org>2008-02-02 11:03:21 +0100
commit48b1ee61db5f513321b7f3360eb17f94ef339872 (patch)
treea18a2d34bdd47a082dd138805cd1e48880194be5 /source3/smbd
parent9f6e983d0b67b64daf27dab130348d3491bad4ac (diff)
downloadsamba-48b1ee61db5f513321b7f3360eb17f94ef339872.tar.gz
samba-48b1ee61db5f513321b7f3360eb17f94ef339872.tar.bz2
samba-48b1ee61db5f513321b7f3360eb17f94ef339872.zip
Convert read_packet_remainder to use read_socket_with_timeout_ntstatus
(This used to be commit fff31f8f35ad26d67e78b9a71cfd35670aa9ac5f)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/process.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index d6301d0d00..02b190f003 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -148,22 +148,34 @@ static ssize_t read_packet_remainder(int fd,
unsigned int timeout,
ssize_t len)
{
- ssize_t ret;
+ NTSTATUS status;
- if(len <= 0) {
+ if (len <= 0) {
return len;
}
- ret = read_socket_with_timeout(fd, buffer, len, len, timeout,
- get_srv_read_error());
+ set_smb_read_error(get_srv_read_error(), SMB_READ_OK);
- if (ret != len) {
- cond_set_smb_read_error(get_srv_read_error(),
- SMB_READ_ERROR);
+ status = read_socket_with_timeout_ntstatus(fd, buffer, len, len,
+ timeout, NULL);
+
+ 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 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;
}
/****************************************************************************