Bug fix for random junk in first file data

smba_read() could end up returning random junk in the first few bytes of a file because the make_open() return value tripped it up.
This commit is contained in:
Olaf Barthel
2016-03-27 18:14:30 +02:00
parent 6b3e54c1db
commit 3562ef9720
+10 -1
View File
@@ -1,5 +1,5 @@
/*
* :ts=8
* :ts=4
*
* Name: smb_abstraction.c
* Description: Smb abstraction layer.
@@ -407,6 +407,15 @@ smba_read (smba_file_t * f, char *data, long len, long offset)
if (result < 0)
goto out;
/* make_open() will return the number of bytes read
from the server, or a negative number if an error
occured. We just reset "result" to 0 here because
it might otherwise cause the number of data bytes
read to be off, which in turn causes the first
few bytes read from a file to contain random
junk. */
result = 0;
D(("read %ld bytes from offset %ld",len,offset));
if (f->server->server.blkmode & 1)