[PATCH 2/3] eal: use common basename function

Bruce Richardson bruce.richardson at intel.com
Wed Aug 6 15:38:32 CEST 2025


Use the new "rte_basename" function which has common behaviour on all
supported platforms. As extra benefit, it removes the need for
recreating the socket path twice, since rte_basename guarantees not
to modify its argument.

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
 lib/eal/common/eal_common_proc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c
index 0dea787e38..62fd4ba88f 100644
--- a/lib/eal/common/eal_common_proc.c
+++ b/lib/eal/common/eal_common_proc.c
@@ -625,10 +625,7 @@ rte_mp_channel_init(void)
 
 	/* create filter path */
 	create_socket_path("*", path, sizeof(path));
-	strlcpy(mp_filter, basename(path), sizeof(mp_filter));
-
-	/* path may have been modified, so recreate it */
-	create_socket_path("*", path, sizeof(path));
+	rte_basename(path, mp_filter, sizeof(mp_filter));
 	strlcpy(mp_dir_path, dirname(path), sizeof(mp_dir_path));
 
 	/* lock the directory */
-- 
2.48.1



More information about the dev mailing list