summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-01-25 21:31:40 +0100
committerVolker Lendecke <vl@samba.org>2008-02-02 11:03:21 +0100
commit9f6e983d0b67b64daf27dab130348d3491bad4ac (patch)
tree182d604e37eb3103f99996eeab3f1fa2fa615d30 /source3/lib
parent0afbfa4284db8204a3696f4fea6cff96965e6074 (diff)
downloadsamba-9f6e983d0b67b64daf27dab130348d3491bad4ac.tar.gz
samba-9f6e983d0b67b64daf27dab130348d3491bad4ac.tar.bz2
samba-9f6e983d0b67b64daf27dab130348d3491bad4ac.zip
Convert read_smb_length to return NTSTATUS
(This used to be commit 5750c3a51b4ddac635a98195d1621b24f91bad3f)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util_sock.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index f62b20b6fc..32dd2bd8a8 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -1174,31 +1174,18 @@ NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
Timeout is in milliseconds.
****************************************************************************/
-ssize_t read_smb_length(int fd, char *inbuf, unsigned int timeout, enum smb_read_errors *pre)
+NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout,
+ size_t *len)
{
- size_t len;
uint8_t msgtype = SMBkeepalive;
- set_smb_read_error(pre, SMB_READ_OK);
-
while (msgtype == SMBkeepalive) {
NTSTATUS status;
status = read_smb_length_return_keepalive(fd, inbuf, timeout,
- &len);
+ len);
if (!NT_STATUS_IS_OK(status)) {
- if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
- set_smb_read_error(pre, SMB_READ_EOF);
- return -1;
- }
-
- if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
- set_smb_read_error(pre, SMB_READ_TIMEOUT);
- return -1;
- }
-
- set_smb_read_error(pre, SMB_READ_ERROR);
- return -1;
+ return status;
}
msgtype = CVAL(inbuf, 0);
@@ -1207,7 +1194,7 @@ ssize_t read_smb_length(int fd, char *inbuf, unsigned int timeout, enum smb_read
DEBUG(10,("read_smb_length: got smb length of %lu\n",
(unsigned long)len));
- return len;
+ return NT_STATUS_OK;
}
/****************************************************************************