From: Aaron Conole Date: Wed, 22 Mar 2017 20:19:32 +0000 (-0400) Subject: eal: set errno when exiting for already initialized X-Git-Tag: spdx-start~4409 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8f113d9818500240f05237e4294c7cae8dcef52f;p=dpdk.git eal: set errno when exiting for already initialized Signed-off-by: Aaron Conole Acked-by: Bruce Richardson --- diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index a71566ca0f..a7a3a25597 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -511,8 +511,11 @@ rte_eal_init(int argc, char **argv) return -1; } - if (!rte_atomic32_test_and_set(&run_once)) + if (!rte_atomic32_test_and_set(&run_once)) { + rte_eal_init_alert("already called initialization."); + rte_errno = EALREADY; return -1; + } thread_id = pthread_self(); diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 5a92b2875b..564cac37ce 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -765,8 +765,11 @@ rte_eal_init(int argc, char **argv) return -1; } - if (!rte_atomic32_test_and_set(&run_once)) + if (!rte_atomic32_test_and_set(&run_once)) { + rte_eal_init_alert("already called initialization."); + rte_errno = EALREADY; return -1; + } logid = strrchr(argv[0], '/'); logid = strdup(logid ? logid + 1: argv[0]);