s4-libcli: Use a do-while loop.
authorAndreas Schneider <asn@samba.org>
Wed, 19 Dec 2012 09:37:08 +0000 (10:37 +0100)
committerGünther Deschner <gd@samba.org>
Fri, 21 Dec 2012 12:56:01 +0000 (13:56 +0100)
Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
source4/libcli/clireadwrite.c

index ae2367918c874ef7c27d3ad4c40e38cf3daedba9..7d8f34a42874ff1fa402c68633cb6439d114b6d4 100644 (file)
@@ -105,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);
@@ -124,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;
 }