Skip to content

Commit

Permalink
in_calyptia_fleet: rename variables in _mkdir to be more legible.
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Whelan <[email protected]>
  • Loading branch information
pwhelan committed Sep 4, 2023
1 parent 1dddd8d commit fd14e97
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions plugins/in_calyptia_fleet/in_calyptia_fleet.c
Original file line number Diff line number Diff line change
Expand Up @@ -844,12 +844,12 @@ static int in_calyptia_fleet_collect(struct flb_input_instance *ins,
// http://nion.modprobe.de/blog/archives/357-Recursive-directory-creation.html
static int _mkdir(const char *dir, int perms) {
char tmp[255];
char *p = NULL;
char *ptr = NULL;
size_t len;
int rc;
int ret;

rc = snprintf(tmp, sizeof(tmp),"%s",dir);
if (rc > sizeof(tmp)) {
ret = snprintf(tmp, sizeof(tmp),"%s",dir);
if (ret > sizeof(tmp)) {
return -1;
}

Expand All @@ -858,16 +858,16 @@ static int _mkdir(const char *dir, int perms) {
tmp[len - 1] = 0;
}

for (p = tmp + 1; *p; p++) {
if (*p == '/') {
*p = 0;
for (ptr = tmp + 1; *ptr; ptr++) {
if (*ptr == '/') {
*ptr = 0;
if (access(tmp, F_OK) != 0) {
rc = mkdir(tmp, perms);
if (rc != 0) {
return rc;
ret = mkdir(tmp, perms);
if (ret != 0) {
return ret;
}
}
*p = '/';
*ptr = '/';
}
}
return mkdir(tmp, perms);
Expand Down

0 comments on commit fd14e97

Please sign in to comment.