It may happen that stat_buf.f_frsize is greater than
BLOCKSIZE (for example, if we use "non-default" FS block sizes or NFS) and
because on (BLOCKSIZE / stat_buf.f_frsize) is 0.

Moved stat_buf.f_frsize to the dividend.

Signed-off-by: Stanislav Kholmanskikh <[email protected]>
---
 testcases/kernel/syscalls/fsync/fsync02.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/testcases/kernel/syscalls/fsync/fsync02.c 
b/testcases/kernel/syscalls/fsync/fsync02.c
index 564f5c6..ffd2e7a 100644
--- a/testcases/kernel/syscalls/fsync/fsync02.c
+++ b/testcases/kernel/syscalls/fsync/fsync02.c
@@ -177,7 +177,7 @@ void setup()
        if (fstatvfs(fd, &stat_buf) != 0)
                tst_brkm(TBROK, cleanup, "fstatvfs failed");
 
-       f_bavail = stat_buf.f_bavail / (BLOCKSIZE / stat_buf.f_frsize);
+       f_bavail = (stat_buf.f_bavail * stat_buf.f_frsize) / BLOCKSIZE;
        if (f_bavail && (f_bavail < MAXBLKS))
                max_blks = f_bavail;
 
-- 
1.7.1


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to