aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.c b/main.c
index f306edd..169f61f 100644
--- a/main.c
+++ b/main.c
@@ -120,7 +120,8 @@ int main(int argc, char *argv[]) {
ERR(signal(SIGHUP, sig_handler) == SIG_ERR, "Could not set SIGHUP handler");
uint32_t pgsize = getpagesize();
- uint32_t trunk_size_byte = (storage_size * 1024 * 1024) / TRUNK_SIZE ; // MiB
+ storage_size *= 1024 * 1024; // MiB
+ uint32_t trunk_size_byte = storage_size / TRUNK_SIZE ;
trunk_size_byte = (trunk_size_byte < TRUNK_SIZE) ? TRUNK_SIZE : trunk_size_byte;
trunk_size_byte = (trunk_size_byte / pgsize) * pgsize; // align with pagesize