summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-02-23 21:03:21 +0000
committerJeremy Allison <jra@samba.org>2002-02-23 21:03:21 +0000
commitde494520b0a8b0d58c0f320e7badad419e878c1e (patch)
treef1f3f74b87417e23bb642f7551b34eea5cfa4095 /source3
parent2a25c0a39b8019ae70327416933991710cc1c7f2 (diff)
downloadsamba-de494520b0a8b0d58c0f320e7badad419e878c1e.tar.gz
samba-de494520b0a8b0d58c0f320e7badad419e878c1e.tar.bz2
samba-de494520b0a8b0d58c0f320e7badad419e878c1e.zip
Only set smb_read_error if not already set.
Jeremy. (This used to be commit 8220135fd16b4a1778e49f8315f64754924af0d8)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util_sock.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 45beb38ac9..9081f28f83 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -663,10 +663,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;
}
@@ -678,7 +683,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;
}
}
@@ -686,7 +699,8 @@ BOOL receive_smb(int fd,char *buffer, unsigned int timeout)
if(len > 0) {
ret = read_socket_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;
}
}