torture: Make sure we use the correct size for cxd.
authorAndreas Schneider <asn@samba.org>
Mon, 10 Dec 2012 16:06:39 +0000 (17:06 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 12 Dec 2012 14:00:02 +0000 (15:00 +0100)
Found by Coverity.

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

index 69717be3ba8eb1a3e184416b639e109a72a5182b..feeea32eb10758766678946e313d4f9e7cce3943 100644 (file)
@@ -2367,9 +2367,10 @@ static bool torture_createx_specific(struct torture_context *tctx, struct
        }
 
        if (data_file_fd >= 0) {
+               size_t cxd_len = sizeof(struct createx_data);
                found = true;
-               res = write(data_file_fd, &cxd, sizeof(cxd));
-               if (res != sizeof(cxd)) {
+               res = write(data_file_fd, &cxd, cxd_len);
+               if (res != cxd_len) {
                        torture_result(tctx, TORTURE_FAIL,
                                "(%s): write failed: %s!",
                                __location__, strerror(errno));