[dpdk-dev] eal: fix wrong config file path

Message ID 1498459786-4523-1-git-send-email-jianfeng.tan@intel.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Jianfeng Tan June 26, 2017, 6:49 a.m. UTC
  When primary process is booted with --file-prefix option, the API,
rte_eal_primary_proc_alive(), uses a wrong config file path to
check if primary process is alive.

Fix it by calling helper function to get config file path.

Fixes: dd3e00138d74 ("eal: check if primary process is alive")
Cc: stable@dpdk.org

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
 lib/librte_eal/common/eal_common_proc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Thomas Monjalon July 5, 2017, 1:07 p.m. UTC | #1
26/06/2017 08:49, Jianfeng Tan:
> When primary process is booted with --file-prefix option, the API,
> rte_eal_primary_proc_alive(), uses a wrong config file path to
> check if primary process is alive.
> 
> Fix it by calling helper function to get config file path.
> 
> Fixes: dd3e00138d74 ("eal: check if primary process is alive")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index 12e0fca..60526ca 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -46,10 +46,10 @@  rte_eal_primary_proc_alive(const char *config_file_path)
 	if (config_file_path)
 		config_fd = open(config_file_path, O_RDONLY);
 	else {
-		char default_path[PATH_MAX+1];
-		snprintf(default_path, PATH_MAX, RUNTIME_CONFIG_FMT,
-			 default_config_dir, "rte");
-		config_fd = open(default_path, O_RDONLY);
+		const char *path;
+
+		path = eal_runtime_config_path();
+		config_fd = open(path, O_RDONLY);
 	}
 	if (config_fd < 0)
 		return 0;