summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-02-23 21:03:19 +0000
committerJeremy Allison <jra@samba.org>2002-02-23 21:03:19 +0000
commit6447ba5fe4fb4582f4a065002ad5d1cacf1aec77 (patch)
treed7cfb291ee2de27f89642df6289677bb5c3d8dd3
parentd66ca48e70e582b288bebac0912f9eb85a1faad6 (diff)
downloadsamba-6447ba5fe4fb4582f4a065002ad5d1cacf1aec77.tar.gz
samba-6447ba5fe4fb4582f4a065002ad5d1cacf1aec77.tar.xz
samba-6447ba5fe4fb4582f4a065002ad5d1cacf1aec77.zip
Only set smb_read_error if not already set.
Jeremy.
-rw-r--r--source/lib/util_sock.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/source/lib/util_sock.c b/source/lib/util_sock.c
index efc2e218ee6..fefcdb0cfb2 100644
--- a/source/lib/util_sock.c
+++ b/source/lib/util_sock.c
@@ -609,10 +609,15 @@ BOOL receive_smb(int fd,char *buffer, unsigned int timeout)
len = read_smb_length_return_keepalive(fd,buffer,timeout);
if (len < 0) {
DEBUG(10,("receive_smb: length < 0!\n"));
- /* XXX: You might think that we ought to set
- * smb_read_error here, but apparently that breaks the
- * recursive main loop in oplock.c. Global variables
- * suck. */
+
+ /*
+ * Correct fix. smb_read_error may have already been
+ * set. Only set it here if not already set. Global
+ * variables still suck :-). JRA.
+ */
+
+ if (smb_read_error == 0)
+ smb_read_error = READ_ERROR;
return(False);
}
@@ -624,7 +629,15 @@ BOOL receive_smb(int fd,char *buffer, unsigned int timeout)
if (len > (BUFFER_SIZE + LARGE_WRITEX_HDR_SIZE)) {
DEBUG(0,("Invalid packet length! (%d bytes).\n",len));
if (len > BUFFER_SIZE + (SAFETY_MARGIN/2)) {
- smb_read_error = READ_ERROR;
+
+ /*
+ * Correct fix. smb_read_error may have already been
+ * set. Only set it here if not already set. Global
+ * variables still suck :-). JRA.
+ */
+
+ if (smb_read_error == 0)
+ smb_read_error = READ_ERROR;
return False;
}
}
@@ -632,7 +645,8 @@ BOOL receive_smb(int fd,char *buffer, unsigned int timeout)
if(len > 0) {
ret = read_data(fd,buffer+4,len);
if (ret != len) {
- smb_read_error = READ_ERROR;
+ if (smb_read_error == 0)
+ smb_read_error = READ_ERROR;
return False;
}
}