diff options
author | Uri Simchoni <uri@samba.org> | 2017-11-19 17:11:28 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2017-11-24 01:13:15 +0100 |
commit | 559367ed60a316943d97a10a14ba11bcc01204c5 (patch) | |
tree | c036b864156a2193b5bcf54aa83f5ea5b7c0b9a7 /source4/torture/raw | |
parent | 899057012187954179297e1b3ae110e717702eba (diff) | |
download | samba-559367ed60a316943d97a10a14ba11bcc01204c5.tar.gz |
s4-torture: fix truncation warnings
Fix various places where there is potential truncation
while doing time / size calculations.
Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/torture/raw')
-rw-r--r-- | source4/torture/raw/open.c | 2 | ||||
-rw-r--r-- | source4/torture/raw/qfileinfo.c | 2 | ||||
-rw-r--r-- | source4/torture/raw/qfsinfo.c | 5 |
3 files changed, 5 insertions, 4 deletions
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index 44b04acda9a..5e8c81c9d07 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -95,7 +95,7 @@ static const char *rdwr_string(enum rdwr_mode m) CHECK_STATUS(status, NT_STATUS_OK); \ t1 = t & ~1; \ t2 = nt_time_to_unix(finfo.all_info.out.field) & ~1; \ - if (abs(t1-t2) > 2) { \ + if (labs(t1-t2) > 2) { \ torture_result(tctx, TORTURE_FAIL, \ "(%s) wrong time for field %s %s - %s\n", \ __location__, #field, \ diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c index 3b89189aa5f..0c5daa3ccc3 100644 --- a/source4/torture/raw/qfileinfo.c +++ b/source4/torture/raw/qfileinfo.c @@ -140,7 +140,7 @@ static struct { static int dos_nt_time_cmp(time_t t, NTTIME nt) { time_t t2 = nt_time_to_unix(nt); - if (abs(t2 - t) <= 2) return 0; + if (labs(t2 - t) <= 2) return 0; return t2 > t ? 1 : -1; } diff --git a/source4/torture/raw/qfsinfo.c b/source4/torture/raw/qfsinfo.c index 259aee0e0ec..0f1717b9cb2 100644 --- a/source4/torture/raw/qfsinfo.c +++ b/source4/torture/raw/qfsinfo.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include <math.h> #include "libcli/libcli.h" #include "torture/util.h" #include "torture/basic/proto.h" @@ -206,7 +207,7 @@ bool torture_raw_qfsinfo(struct torture_context *torture, s2->allocation.out.sectors_per_unit * s2->allocation.out.total_alloc_units * s2->allocation.out.bytes_per_sector / scale; - if (abs(size1 - size2) > 1) { + if (fabs(size1 - size2) > 1) { printf("Inconsistent total size in DSKATTR and ALLOCATION - size1=%.0f size2=%.0f\n", size1, size2); ret = false; @@ -228,7 +229,7 @@ bool torture_raw_qfsinfo(struct torture_context *torture, s2->allocation.out.sectors_per_unit * s2->allocation.out.avail_alloc_units * s2->allocation.out.bytes_per_sector / scale; - if (abs(size1 - size2) > 1) { + if (fabs(size1 - size2) > 1) { printf("Inconsistent avail size in DSKATTR and ALLOCATION - size1=%.0f size2=%.0f\n", size1, size2); ret = false; |