summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-03-20 01:47:31 +0000
committerJeremy Allison <jra@samba.org>2002-03-20 01:47:31 +0000
commita1249aca906e9624edada1b4e9c654b568897dce (patch)
treeab0c1db602bb2a1bba0b37ee54b67f1ffba5aa47
parent6586062d1a803952d671f145de9373b08721dbb9 (diff)
downloadsamba-a1249aca906e9624edada1b4e9c654b568897dce.tar.gz
samba-a1249aca906e9624edada1b4e9c654b568897dce.tar.bz2
samba-a1249aca906e9624edada1b4e9c654b568897dce.zip
Correctly increment offset in cli_smbwrite.
Jeremy. (This used to be commit 5b04b5f1df3ee509e7314064966be09e2202b0ef)
-rw-r--r--source3/libsmb/clireadwrite.c2
-rw-r--r--source3/torture/torture.c32
2 files changed, 25 insertions, 9 deletions
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c
index 402de726e8..0a9569fc69 100644
--- a/source3/libsmb/clireadwrite.c
+++ b/source3/libsmb/clireadwrite.c
@@ -366,6 +366,8 @@ ssize_t cli_smbwrite(struct cli_state *cli,
size1 -= size;
total += size;
+ offset += size;
+
} while (size1);
return total;
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 5c195558bb..f4c816b325 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -555,7 +555,7 @@ static BOOL run_readwritelarge(int dummy)
int fnum1;
char *lockfname = "\\large.dat";
size_t fsize;
- char buf[0x10000];
+ char buf[126*1024];
BOOL correct = True;
if (!torture_open_connection(&cli1)) {
@@ -564,7 +564,7 @@ static BOOL run_readwritelarge(int dummy)
cli_sockopt(&cli1, sockops);
memset(buf,'\0',sizeof(buf));
- cli1.max_xmit = 0x11000;
+ cli1.max_xmit = 128*1024;
printf("starting readwritelarge\n");
@@ -578,13 +578,8 @@ static BOOL run_readwritelarge(int dummy)
cli_write(&cli1, fnum1, 0, buf, 0, sizeof(buf));
- if (!cli_close(&cli1, fnum1)) {
- printf("close failed (%s)\n", cli_errstr(&cli1));
- correct = False;
- }
-
- if (!cli_qpathinfo(&cli1, lockfname, NULL, NULL, NULL, &fsize, NULL)) {
- printf("qpathinfo failed (%s)\n", cli_errstr(&cli1));
+ if (!cli_qfileinfo(&cli1, fnum1, NULL, &fsize, NULL, NULL, NULL, NULL, NULL)) {
+ printf("qfileinfo failed (%s)\n", cli_errstr(&cli1));
correct = False;
}
@@ -595,6 +590,11 @@ static BOOL run_readwritelarge(int dummy)
correct = False;
}
+ if (!cli_close(&cli1, fnum1)) {
+ printf("close failed (%s)\n", cli_errstr(&cli1));
+ correct = False;
+ }
+
if (!cli_unlink(&cli1, lockfname)) {
printf("unlink failed (%s)\n", cli_errstr(&cli1));
correct = False;
@@ -606,8 +606,22 @@ static BOOL run_readwritelarge(int dummy)
return False;
}
+ cli1.max_xmit = 4*1024;
+
cli_smbwrite(&cli1, fnum1, buf, 0, sizeof(buf));
+ if (!cli_qfileinfo(&cli1, fnum1, NULL, &fsize, NULL, NULL, NULL, NULL, NULL)) {
+ printf("qfileinfo failed (%s)\n", cli_errstr(&cli1));
+ correct = False;
+ }
+
+ if (fsize == sizeof(buf))
+ printf("readwritelarge test 2 succeeded (size = %x)\n", fsize);
+ else {
+ printf("readwritelarge test 2 failed (size = %x)\n", fsize);
+ correct = False;
+ }
+
if (!cli_close(&cli1, fnum1)) {
printf("close failed (%s)\n", cli_errstr(&cli1));
correct = False;