Glibc already has a documented variable with the program
name so use it instead of computing the value.

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 lib/eal/linux/eal.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index fabafbc39bd5..10cef8c90517 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -968,8 +968,6 @@ rte_eal_init(int argc, char **argv)
        int i, fctret, ret;
        static uint32_t run_once;
        uint32_t has_run = 0;
-       const char *p;
-       static char logid[PATH_MAX];
        char cpuset[RTE_CPU_AFFINITY_STR_LEN];
        char thread_name[RTE_MAX_THREAD_NAME_LEN];
        bool phys_addrs;
@@ -991,9 +989,6 @@ rte_eal_init(int argc, char **argv)
                return -1;
        }
 
-       p = strrchr(argv[0], '/');
-       strlcpy(logid, p ? p + 1 : argv[0], sizeof(logid));
-
        eal_reset_internal_config(internal_conf);
 
        /* set log level as early as possible */
@@ -1172,7 +1167,8 @@ rte_eal_init(int argc, char **argv)
 #endif
        }
 
-       if (eal_log_init(logid, internal_conf->syslog_facility) < 0) {
+       if (eal_log_init(program_invocation_short_name,
+                        internal_conf->syslog_facility) < 0) {
                rte_eal_init_alert("Cannot init logging.");
                rte_errno = ENOMEM;
                __atomic_store_n(&run_once, 0, __ATOMIC_RELAXED);
-- 
2.39.2

Reply via email to