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

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

@AlexStocks

Description

@AlexStocks

在测试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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions