From a83953a094f1a41f3633ae24cdfd3a6cb804d986 Mon Sep 17 00:00:00 2001 From: Uri Simchoni Date: Sun, 19 Nov 2017 17:13:26 +0000 Subject: [PATCH] s4-torture: fix file time checks NTTIME is an unsigned quantity. When comparing two of them, first calculate a signed difference, then take absolute value. Signed-off-by: Uri Simchoni Reviewed-by: Andrew Bartlett --- source4/torture/raw/open.c | 2 +- source4/torture/smb2/create.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index c3cb48413397..44b04acda9a7 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -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, \ diff --git a/source4/torture/smb2/create.c b/source4/torture/smb2/create.c index 397c07516dd8..ead56eb5c40c 100644 --- a/source4/torture/smb2/create.c +++ b/source4/torture/smb2/create.c @@ -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, \