aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/linux
diff options
context:
space:
mode:
authorDave Barach <dbarach@cisco.com>2018-04-10 11:00:50 -0400
committerDave Barach <dbarach@cisco.com>2018-04-11 11:32:38 -0400
commit9840ccada14f1c67b09323b5f4d96d2d7334a5cc (patch)
tree12dcad0975b66a97cf322900245205cbbb024b93 /src/vppinfra/linux
parent334167f290cb1f9f8eb19423648075b5048fb0a3 (diff)
Clean up temp dir in failure cases
Change-Id: Icfb99a09726c01e96ff14967afbafa4116e02eff Signed-off-by: Dave Barach <dbarach@cisco.com>
Diffstat (limited to 'src/vppinfra/linux')
-rw-r--r--src/vppinfra/linux/mem.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vppinfra/linux/mem.c b/src/vppinfra/linux/mem.c
index 475e3dcd747..d479da3f0cb 100644
--- a/src/vppinfra/linux/mem.c
+++ b/src/vppinfra/linux/mem.c
@@ -127,6 +127,7 @@ clib_mem_vm_ext_alloc (clib_mem_vm_alloc_t * a)
if (mount ("none", (char *) mount_dir, "hugetlbfs", 0, NULL))
{
+ rmdir ((char *) mount_dir);
err = clib_error_return_unix (0, "mount hugetlb directory '%s'",
mount_dir);
goto error;
@@ -136,6 +137,8 @@ clib_mem_vm_ext_alloc (clib_mem_vm_alloc_t * a)
if ((fd = open ((char *) filename, O_CREAT | O_RDWR, 0755)) == -1)
{
+ umount2 ((char *) mount_dir, MNT_DETACH);
+ rmdir ((char *) mount_dir);
err = clib_error_return_unix (0, "open");
goto error;
}