diff options
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_sock.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index ce1569d021..ced1130536 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -1150,16 +1150,15 @@ ssize_t read_smb_length_return_keepalive(int fd, ssize_t read_smb_length(int fd, char *inbuf, unsigned int timeout, enum smb_read_errors *pre) { ssize_t len; + uint8_t msgtype = SMBkeepalive; - for(;;) { - len = read_smb_length_return_keepalive(fd, inbuf, timeout, pre); - - if(len < 0) + while (msgtype == SMBkeepalive) { + len = read_smb_length_return_keepalive(fd, inbuf, timeout, + pre); + if (len < 0) { return len; - - /* Ignore session keepalives. */ - if(CVAL(inbuf,0) != SMBkeepalive) - break; + } + msgtype = CVAL(inbuf, 0); } DEBUG(10,("read_smb_length: got smb length of %lu\n", |