samldb: Allow automatic generation of mAPIIDs
[sfrench/samba-autobuild/.git] / source4 / libcli / clireadwrite.c
index f5ba799bbca0a2764c98c3cd9472fca3286e4371..7d8f34a42874ff1fa402c68633cb6439d114b6d4 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "includes.h"
 #include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
 #include "libcli/libcli.h"
 
 /****************************************************************************
@@ -104,8 +105,8 @@ ssize_t smbcli_write(struct smbcli_tree *tree,
        parms.writex.in.file.fnum = fnum;
        parms.writex.in.wmode = write_mode;
        parms.writex.in.remaining = 0;
-       
-       while (total < size) {
+
+       do {
                NTSTATUS status;
 
                block = MIN(block, size - total);
@@ -123,7 +124,7 @@ ssize_t smbcli_write(struct smbcli_tree *tree,
                offset += parms.writex.out.nwritten;
                total += parms.writex.out.nwritten;
                buf += parms.writex.out.nwritten;
-       }
+       } while (total < size);
 
        return total;
 }