From: Reshma Pattan Date: Mon, 10 Oct 2016 14:35:48 +0000 (+0100) Subject: pdump: fix created directory permissions X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1a0c9cb015b89ba0616f72e706a597805d5b955f;p=dpdk.git pdump: fix created directory permissions Inside the function pdump_get_socket_path(), pdump socket directories are created using mkdir() call with permissions 700, which was assigning wrong permissions to the directories i.e. "d-w-r-xr-T" instead of drwx---. The reason is mkdir() call doesn't consider 700 as an octal value until unless 0 is explicitly added before the value. Because of this, socket creation failure is observed when DPDK application was ran in non root user mode. DPDK application running in root user mode never reported the issue. So 0 is prefixed to the value to create directories with the correct permissions. Fixes: e4ffa2d3 ("pdump: fix error handlings") Fixes: bdd8dcc6 ("pdump: fix default socket path") Reported-by: Jianfeng Tan Signed-off-by: Reshma Pattan Acked-by: Remy Horton --- diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c index 9b921ce208..ea5ccd988c 100644 --- a/lib/librte_pdump/rte_pdump.c +++ b/lib/librte_pdump/rte_pdump.c @@ -471,12 +471,12 @@ pdump_get_socket_path(char *buffer, int bufsz, enum rte_pdump_socktype type) snprintf(dpdk_dir, sizeof(dpdk_dir), "%s%s", SOCKET_PATH_VAR_RUN, DPDK_DIR); - mkdir(dpdk_dir, 700); + mkdir(dpdk_dir, 0700); snprintf(dir, sizeof(dir), "%s%s", dpdk_dir, SOCKET_DIR); } - ret = mkdir(dir, 700); + ret = mkdir(dir, 0700); /* if user passed socket path is invalid, return immediately */ if (ret < 0 && errno != EEXIST) { RTE_LOG(ERR, PDUMP,