diff options
author | Ole Troan <ot@cisco.com> | 2017-08-17 11:07:33 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2017-08-18 16:46:30 +0000 |
commit | 3cdc25ffbaa572639f99e197172c568e4324bc03 (patch) | |
tree | 268a6e9597028620d5b3d442f658921902a4eec5 /src/vlibmemory | |
parent | 8ea8916bb8fa85b298e0e5700ba15e4455235015 (diff) |
API: More gracefully fail when opening shared memory segment fails.
API clients would fail with an ASSERT (and core dump) whenever
the API shared memory segment could not be opened.
This returns an error value to the client's connect instead.
Change-Id: Id122a3a090b24b139c382ae09f341bde61fd2540
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vlibmemory')
-rw-r--r-- | src/vlibmemory/memory_shared.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/vlibmemory/memory_shared.c b/src/vlibmemory/memory_shared.c index 9bab6573..fbdabd06 100644 --- a/src/vlibmemory/memory_shared.c +++ b/src/vlibmemory/memory_shared.c @@ -337,7 +337,7 @@ vl_map_shmem (const char *region_name, int is_vlib) void *oldheap; vl_shmem_hdr_t *shmem_hdr = 0; api_main_t *am = &api_main; - int i; + int i, rv; struct timespec ts, tsrem; u32 vlib_input_queue_length; @@ -352,7 +352,11 @@ vl_map_shmem (const char *region_name, int is_vlib) } if (is_vlib == 0) - svm_region_init_chroot (am->root_path); + { + rv = svm_region_init_chroot (am->root_path); + if (rv) + return rv; + } if (a->root_path != NULL) { |