Skip to content

Commit

Permalink
s4-torture: fix file time checks
Browse files Browse the repository at this point in the history
NTTIME is an unsigned quantity. When comparing two
of them, first calculate a signed difference, then
take absolute value.

Signed-off-by: Uri Simchoni <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
  • Loading branch information
urisimchoni authored and abartlet committed Nov 22, 2017
1 parent 5fd0402 commit a83953a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source4/torture/raw/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand Down
2 changes: 1 addition & 1 deletion source4/torture/smb2/create.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand Down

0 comments on commit a83953a

Please sign in to comment.