Coding style is religion

This commit is contained in:
2017-05-17 18:43:29 +03:00
parent 6d0a190c2f
commit b7df1d32fd
7 changed files with 47 additions and 44 deletions

View File

@@ -42,12 +42,12 @@ struct conf_table conf = {
}
};
const char* conf_db_pass(void)
const char *conf_db_pass(void)
{
return conf.db.pass;
}
const char* conf_db_hostname(void)
const char *conf_db_hostname(void)
{
return conf.db.hostname;
}
@@ -111,7 +111,7 @@ static int fopen_and_mkdir(const char *dir)
for (p = tmp + 1; *p; p++)
if (*p == '/') {
*p = 0;
if (mkdir(tmp, S_IRWXU) == -1 && errno != EEXIST) {
if (mkdir(tmp, 0700) == -1 && errno != EEXIST) {
log(ERROR,
"Permission denied to create directory: %s",
tmp);
@@ -147,8 +147,8 @@ static int test_conf_perms(void)
log(ERROR, confresult);
return 1;
}
if (!(S_IRUSR & s.st_mode) ||
!(S_IXUSR & s.st_mode)) {
if (!(0400 & s.st_mode) ||
!(0100 & s.st_mode)) {
enumtostr(confresult, CONF_DIR_PERM);
log(ERROR, confresult);
return 1;
@@ -159,8 +159,8 @@ static int test_conf_perms(void)
} else if (s.st_gid != 0) {
enumtostr(confresult, CONF_DIR_GID_INSECURE);
log(WARNING, confresult);
} else if ((S_IROTH & s.st_mode) ||
(S_IWOTH & s.st_mode)) {
} else if ((0004 & s.st_mode) ||
(0002 & s.st_mode)) {
enumtostr(confresult, CONF_DIR_PERM_INSECURE);
log(WARNING, confresult);
}
@@ -180,7 +180,7 @@ static int test_conf_perms(void)
log(ERROR, confresult);
return 1;
}
if (!(S_IRUSR & s.st_mode)) {
if (!(0400 & s.st_mode)) {
enumtostr(confresult, CONF_PERM);
log(ERROR, confresult);
return 1;
@@ -191,8 +191,8 @@ static int test_conf_perms(void)
} else if (s.st_gid != 0) {
enumtostr(confresult, CONF_FILE_GID_INSECURE);
log(WARNING, confresult);
} else if ((S_IROTH & s.st_mode) ||
(S_IWOTH & s.st_mode)) {
} else if ((0004 & s.st_mode) ||
(0002 & s.st_mode)) {
enumtostr(confresult, CONF_FILE_PERM_INSECURE);
log(WARNING, confresult);
}