If the configuration file is absent, the autodetection function should
generate and secure it. Otherwise, multiple simultaneous openings could
erroneously identify themselves as primary instances.
Fixes: af75078fece3 ("first public release")
Cc: [email protected]
Signed-off-by: Artemy Kovalyov <[email protected]>
---
lib/eal/linux/eal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 57da058..9b59cec 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -360,7 +360,7 @@ enum rte_proc_type_t
* keep that open and don't close it to prevent a race condition
* between multiple opens.
*/
- if (((mem_cfg_fd = open(pathname, O_RDWR)) >= 0) &&
+ if (((mem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0600)) >=
0) &&
(fcntl(mem_cfg_fd, F_SETLK, &wr_lock) < 0))
ptype = RTE_PROC_SECONDARY;
}
--
1.8.3.1