For some files such as hugepages files, ftruncate() fails with the error
"Invalid argument" if the 'length' parameter is not on a page boundary.
Change-Id: I42a9cde98707da15e3c5d1653046e2277fc7a424
Signed-off-by: Igor Mikhailov (imichail) <[email protected]>
(cherry picked from commit
7d25415a9384d4c3d786d0c1ae5c0fcff3112acd)
}
if (fd != -1)
- if ((ftruncate (fd, a->size)) == -1)
+ if ((ftruncate (fd, n_pages * (1 << log2_page_size))) == -1)
{
err = clib_error_return_unix (0, "ftruncate");
goto error;