Skip to content

Commit

Permalink
remove extra semicolons
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekun committed Feb 24, 2022
1 parent eff68fd commit fd38dbe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
28 changes: 14 additions & 14 deletions src/bindfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,15 +395,15 @@ static int filefilter_check(const char *path, mode_t mode, mode_t *f_mode)
} else { /* is it possible? */
errno = EIO;
goto out;
};
}
} else {
/* To protect hidden files from overwriting (say, we have
* 'p:testfifo' policy and do 'mv regular_file testfifo'),
* we should check mode of existing files on write operations,
* not desired mode for new file */
which = mode ? OVERWRITE : EXISTING;
mode = st.st_mode;
};
}

mode &= S_IFMT;

Expand All @@ -415,7 +415,7 @@ static int filefilter_check(const char *path, mode_t mode, mode_t *f_mode)
if (filefilter_find_match(settings.filefilter,fn,mode) == filefilter_status_found) {
errno = (which == NEW || which == OVERWRITE) ? EPERM : ENOENT;
goto out;
};
}

errno = 0;
out:
Expand Down Expand Up @@ -2397,7 +2397,7 @@ static int parse_file_filter(FileFilter *filter, char *spec)
if (strlen(spec) < 1) {
fprintf(stderr,"Pattern string not specified\n");
return 0;
};
}

/* Glob pattern might be longer than NAME_MAX, so don't use it
* as a limit. But in the other side, ARG_MAX on Linux is 2MB,
Expand All @@ -2424,8 +2424,8 @@ static int parse_file_filter(FileFilter *filter, char *spec)
type = FFT_ANY;
cpos = FN;
continue;
};
};
}
}

if (cpos == MODE) {
switch(*p) {
Expand All @@ -2442,41 +2442,41 @@ static int parse_file_filter(FileFilter *filter, char *spec)
if (next == '/' || next == '\0') {
fprintf(stderr,"Invalid syntax: matching pattern not specified after mode specifier\n");
goto fail;
};
}
cpos = FN;
continue;
break;
default:
fprintf(stderr,"Invalid syntax: '%c' is not a valid mode token\n",*p);
goto fail;
break;
};
};
}
}

if (cpos == FN) {
if (fn_pos >= FF_FN_LIMIT-1) {
fprintf(stderr,"Filename pattern too long\n");
goto fail;
};
}
if (*p == '/' || *p == '\0') {
fprintf(stderr,"Empty filename pattern\n");
goto fail;
};
}

fn[fn_pos++] = *p;
if (next == '/' || next == '\0') {
fn[fn_pos] = '\0';
if ((ret = filefilter_add(settings.filefilter,fn,type)) != filefilter_status_ok) {
fprintf(stderr,"Inserting filter spec '%s' failed: %s\n",fn,ffstatus_str(ret));
goto fail;
};
}
fn_pos = 0;
free(fn);
fn = malloc(FF_FN_LIMIT);
cpos = SLASH;
continue;
};
};
}
}
}

free(fn);
Expand Down
12 changes: 6 additions & 6 deletions src/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ FFStatus filefilter_add(FileFilter *f, char *spec, FFType type)
while(f->name[++pos] != NULL) {
if (strcmp(f->name[pos],newname) == 0)
return filefilter_status_dupfound;
};
}
f->name = (char**)realloc(f->name, sizeof(char*)*(pos+2));
f->type = (FFType*)realloc(f->type, sizeof(FFType)*(pos+2));
f->has_wildcard = (char*)realloc(f->has_wildcard, sizeof(char)*(pos+2));
Expand Down Expand Up @@ -93,7 +93,7 @@ FFStatus filefilter_add(FileFilter *f, char *spec, FFType type)
f->has_wildcard[pos] = 1;
} else {
f->has_wildcard[pos] = 0;
};
}

return filefilter_status_ok;
}
Expand All @@ -105,10 +105,10 @@ FFStatus filefilter_find_match(FileFilter *f, char *fn, mode_t type)

if (strlen(fn) == 0) {
return filefilter_status_incorrect_name;
};
}
if (!(type_b&FFT_ANY)) {
return filefilter_status_incorrect_mode;
};
}

while(f->name[++pos] != NULL) {
if (!(f->type[pos]&type_b))
Expand All @@ -119,8 +119,8 @@ FFStatus filefilter_find_match(FileFilter *f, char *fn, mode_t type)
} else {
if (strcmp(f->name[pos],fn) == 0)
return filefilter_status_found;
};
};
}
}

return filefilter_status_notfound;
}

0 comments on commit fd38dbe

Please sign in to comment.