Cleanups and small fixes
This commit is contained in:
16
confparser.c
16
confparser.c
@@ -73,7 +73,7 @@ static int fopen_and_mkdir(const char *dir) {
|
||||
char tmp[256];
|
||||
char *p = NULL;
|
||||
size_t len;
|
||||
FILE *fd;
|
||||
FILE *fp;
|
||||
|
||||
snprintf(tmp, sizeof(tmp),"%s",dir);
|
||||
len = strlen(tmp);
|
||||
@@ -90,12 +90,12 @@ static int fopen_and_mkdir(const char *dir) {
|
||||
}
|
||||
*p = '/';
|
||||
}
|
||||
fd = fopen(dir, "a");
|
||||
if (!fd) {
|
||||
fp = fopen(dir, "a");
|
||||
if (!fp) {
|
||||
log_trace(ERROR, "Permission denied to write into: %s", dir);
|
||||
return 1;
|
||||
}
|
||||
fclose(fd);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -179,14 +179,14 @@ static int test_conf_syntax()
|
||||
{
|
||||
int i, j = 0, ok = 1, failed = 0;
|
||||
char buf[CFGLINESIZE], *tmp;
|
||||
FILE *fd = fopen("/etc/rmps/rmps.conf", "r");
|
||||
FILE *fp = fopen("/etc/rmps/rmps.conf", "r");
|
||||
|
||||
if (fd == NULL) {
|
||||
if (fp == NULL) {
|
||||
log_trace(ERROR, "Failed to read /etc/rmps/rmps.conf");
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (fgets(buf, CFGLINESIZE, fd) != NULL) {
|
||||
while (fgets(buf, CFGLINESIZE, fp) != NULL) {
|
||||
j++;
|
||||
/* kill comments and ignore BLANK lines */
|
||||
if ((tmp = strstr(buf, "#")))
|
||||
@@ -318,7 +318,7 @@ static int test_conf_syntax()
|
||||
ok = !ok;
|
||||
}
|
||||
}
|
||||
fclose(fd);
|
||||
fclose(fp);
|
||||
|
||||
if (failed)
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user