aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vpp/stats/stat_segment.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/vpp/stats/stat_segment.c b/src/vpp/stats/stat_segment.c
index 4244acb1dd0..0b5ea3048d5 100644
--- a/src/vpp/stats/stat_segment.c
+++ b/src/vpp/stats/stat_segment.c
@@ -330,13 +330,12 @@ vlib_map_stat_segment_init (void)
mfd = clib_mem_vm_create_fd (sm->log2_page_sz, mem_name);
- /* Set size */
- if ((ftruncate (mfd, memory_size)) == -1)
- return clib_error_return (0, "stat segment ftruncate failure");
-
if (mfd == -1)
return clib_error_return (0, "stat segment memory fd failure: %U",
format_clib_error, clib_mem_get_last_error ());
+ /* Set size */
+ if ((ftruncate (mfd, memory_size)) == -1)
+ return clib_error_return (0, "stat segment ftruncate failure");
memaddr = clib_mem_vm_map_shared (0, memory_size, mfd, 0, mem_name);