Skip to content
This repository has been archived by the owner on Oct 24, 2019. It is now read-only.

nlb/src/comm/nlbfile.c:check_and_mkdir权限错误 #42

Open
AlexStocks opened this issue Dec 11, 2017 · 0 comments
Open

nlb/src/comm/nlbfile.c:check_and_mkdir权限错误 #42

AlexStocks opened this issue Dec 11, 2017 · 0 comments

Comments

@AlexStocks
Copy link

AlexStocks commented Dec 11, 2017

在测试nlb/agent的时候,发现用户vag启动进程agent,agent进程创建的/var/nlb,vag用户却进不去,最后发现是nlb/src/comm/nlbfile.c:check_and_mkdir代码写的有瑕疵,现改动如下:

mode_t getumask()
{
    mode_t mask = umask(0);
    return mask;
}

/**
* @brief 检查并创建目录
*/
bool check_and_mkdir(const char *path)
{
    if (!path) {
        return false;
    }
 
    if (!check_dir_exist(path)) {
        mode_t mask = getumask();
        if (mkdir(path, ~mask & 0777) < 0)  {
         return false;
        }
    }
 
    return true;
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant