r2959: If we want to support writes >= 65536 with cli_write, then it had better
authorRichard Sharpe <sharpe@samba.org>
Thu, 14 Oct 2004 03:19:57 +0000 (03:19 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:52:57 +0000 (10:52 -0500)
return a size_t, not an ssize_t, and we had better left shift the upper
part of the write count, not right shift it.
(This used to be commit 3eb33fbc64415600d62ff7b1f2edd67d2dac05b4)

source3/libsmb/clireadwrite.c

index 3f14e530943d634bd7b9ad01fc2067acff059429..d1a23d36c8b0cc568f5afdba1312401492494a2b 100644 (file)
@@ -318,9 +318,9 @@ static BOOL cli_issue_write(struct cli_state *cli, int fnum, off_t offset,
               0x0008 start of message mode named pipe protocol
 ****************************************************************************/
 
-ssize_t cli_write(struct cli_state *cli,
-                 int fnum, uint16 write_mode,
-                 const char *buf, off_t offset, size_t size)
+size_t cli_write(struct cli_state *cli,
+                int fnum, uint16 write_mode,
+                const char *buf, off_t offset, size_t size)
 {
        int bwritten = 0;
        int issued = 0;
@@ -358,7 +358,7 @@ ssize_t cli_write(struct cli_state *cli,
                        break;
 
                bwritten += SVAL(cli->inbuf, smb_vwv2);
-               bwritten += (((int)(SVAL(cli->inbuf, smb_vwv4)))>>16);
+               bwritten += (((int)(SVAL(cli->inbuf, smb_vwv4)))<<16);
        }
 
        while (received < issued && cli_receive_smb(cli))