s4-torture: fix file time checks
authorUri Simchoni <uri@samba.org>
Sun, 19 Nov 2017 17:13:26 +0000 (17:13 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 22 Nov 2017 09:20:20 +0000 (10:20 +0100)
NTTIME is an unsigned quantity. When comparing two
of them, first calculate a signed difference, then
take absolute value.

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/torture/raw/open.c
source4/torture/smb2/create.c

index c3cb48413397cf8c3e83ef0417ee7deeb2357530..44b04acda9a7db34da1a12a39a1cfee48cf9795c 100644 (file)
@@ -112,7 +112,7 @@ static const char *rdwr_string(enum rdwr_mode m)
        status = smb_raw_pathinfo(cli->tree, tctx, &finfo); \
        CHECK_STATUS(status, NT_STATUS_OK); \
        t2 = finfo.all_info.out.field; \
-       if (abs(t-t2) > 20000) { \
+       if (llabs((int64_t)(t-t2)) > 20000) { \
                torture_result(tctx, TORTURE_FAIL, \
                       "(%s) wrong time for field %s  %s - %s\n", \
                       __location__, #field, \
index 397c07516dd8273728a2fcc575037b238a5e6d35..ead56eb5c40c8e8e93ad3c82ad88e50306bf594c 100644 (file)
@@ -81,7 +81,7 @@
        status = smb2_getinfo_file(tree, tctx, &finfo); \
        CHECK_STATUS(status, NT_STATUS_OK); \
        t2 = finfo.all_info.out.field; \
-       if (abs(t-t2) > 20000) { \
+       if (llabs((int64_t)(t-t2)) > 20000) { \
                torture_result(tctx, TORTURE_FAIL, \
                        "(%s) wrong time for field %s  %s - %s\n", \
                       __location__, #field, \