s3-torture: rw_torture3(): replace cli_read_old() with cli_read()
authorBjörn Baumbach <bb@sernet.de>
Tue, 19 Jul 2011 13:49:03 +0000 (15:49 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 20 Jul 2011 20:09:26 +0000 (22:09 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/torture/torture.c

index 8757904cd3c7b9c9901af480f1a8fe8934f1a9e0..b17171138fbc91cf1ee7dc7f8d0108c8009f07fe 100644 (file)
@@ -695,7 +695,7 @@ static bool rw_torture3(struct cli_state *c, char *lockfname)
        char buf_rd[131072];
        unsigned count;
        unsigned countprev = 0;
-       ssize_t sent = 0;
+       size_t sent = 0;
        bool correct = True;
        NTSTATUS status = NT_STATUS_OK;
 
@@ -760,7 +760,7 @@ static bool rw_torture3(struct cli_state *c, char *lockfname)
                        }
 
                        status = cli_writeall(c, fnum, 0, (uint8_t *)buf+count,
-                                             count, (size_t)sent, NULL);
+                                             count, sent, NULL);
                        if (!NT_STATUS_IS_OK(status)) {
                                printf("write failed (%s)\n",
                                       nt_errstr(status));
@@ -769,18 +769,15 @@ static bool rw_torture3(struct cli_state *c, char *lockfname)
                }
                else
                {
-                       sent = cli_read_old(c, fnum, buf_rd+count, count,
-                                                 sizeof(buf)-count);
-                       if (sent < 0)
-                       {
+                       status = cli_read(c, fnum, buf_rd+count, count,
+                                         sizeof(buf)-count, &sent);
+                       if(!NT_STATUS_IS_OK(status)) {
                                printf("read failed offset:%d size:%ld (%s)\n",
                                       count, (unsigned long)sizeof(buf)-count,
-                                      cli_errstr(c));
+                                      nt_errstr(status));
                                correct = False;
                                sent = 0;
-                       }
-                       if (sent > 0)
-                       {
+                       } else if (sent > 0) {
                                if (memcmp(buf_rd+count, buf+count, sent) != 0)
                                {
                                        printf("read/write compare failed\n");