mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Changes the exclude rules to be applied also to directories.
This commit is contained in:
parent
2d6528fe90
commit
02f26ca9a1
6 changed files with 16 additions and 16 deletions
3
HISTORY
3
HISTORY
|
|
@ -28,6 +28,9 @@ SnapRAID HISTORY
|
|||
You must use the 'nohidden' option in the configuration file.
|
||||
* When opening files in read-only mode, also specify the noatime flag,
|
||||
to avoid to update the file access time.
|
||||
* Exclude rules are now also applied to directories.
|
||||
This allows to excludes some file/directory without the need to call
|
||||
the stat() function on them.
|
||||
|
||||
1.13 2012/11
|
||||
============
|
||||
|
|
|
|||
8
TODO
8
TODO
|
|
@ -32,14 +32,6 @@ is too complex.
|
|||
|
||||
- v2.x
|
||||
|
||||
* Checked the include/exclude rules for FILE to include also directories.
|
||||
This is needed to allow to exclude files, before even calling stat() on them
|
||||
to know if they are file or directory.
|
||||
There are some cases where this is needed, like for the ".gvfs" mounted fuse directory by
|
||||
gnome that cannot have stat() called *EVEN* by root.
|
||||
This is totally wrong, because the stat() manpage explicitely tells that no permissions are
|
||||
needed to call stat().
|
||||
|
||||
* Remove the old MD5 support.
|
||||
|
||||
* A new 'init' command to differentiate the first 'sync' operation.
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ static int open_noatime(const char* file, int flags)
|
|||
return f;
|
||||
}
|
||||
#else
|
||||
#define open_noatime open
|
||||
#define open_noatime open
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
|||
11
scan.c
11
scan.c
|
|
@ -480,6 +480,14 @@ static void scan_dir(struct snapraid_scan* scan, struct snapraid_state* state, i
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* exclude files before doing any check on them */
|
||||
if (filter_path(&state->filterlist, disk->name, sub_next) != 0) {
|
||||
if (state->verbose) {
|
||||
printf("Excluding file '%s'\n", path_next);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
/* get info about the file */
|
||||
if (lstat(path_next, &st) != 0) {
|
||||
fprintf(stderr, "Error in stat file/directory '%s'. %s.\n", path_next, strerror(errno));
|
||||
|
|
@ -489,7 +497,6 @@ static void scan_dir(struct snapraid_scan* scan, struct snapraid_state* state, i
|
|||
if (S_ISREG(st.st_mode)) {
|
||||
if (filter_hidden(state->filter_hidden, dd, &st) == 0
|
||||
&& filter_content(&state->contentlist, path_next) == 0
|
||||
&& filter_path(&state->filterlist, disk->name, sub_next) == 0
|
||||
) {
|
||||
/* check for read permission */
|
||||
if (access(path_next, R_OK) != 0) {
|
||||
|
|
@ -514,7 +521,6 @@ static void scan_dir(struct snapraid_scan* scan, struct snapraid_state* state, i
|
|||
}
|
||||
} else if (S_ISLNK(st.st_mode)) {
|
||||
if (filter_hidden(state->filter_hidden, dd, &st) == 0
|
||||
&& filter_path(&state->filterlist, disk->name, sub_next) == 0
|
||||
) {
|
||||
char subnew[PATH_MAX];
|
||||
int ret;
|
||||
|
|
@ -553,7 +559,6 @@ static void scan_dir(struct snapraid_scan* scan, struct snapraid_state* state, i
|
|||
} else {
|
||||
if (filter_hidden(state->filter_hidden, dd, &st) == 0
|
||||
&& filter_content(&state->contentlist, path_next) == 0
|
||||
&& filter_path(&state->filterlist, disk->name, sub_next) == 0
|
||||
) {
|
||||
fprintf(stderr, "warning: Ignoring special '%s' file '%s'\n", stat_desc(&st), path_next);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -644,7 +644,7 @@ There are four different types of patterns:
|
|||
.B FILE
|
||||
Selects any file named as FILE. You can use any globbing
|
||||
character like * and ?.
|
||||
This pattern is applied only to files and not to directories.
|
||||
This pattern is applied to both files and directories.
|
||||
.TP
|
||||
.B DIR/
|
||||
Selects any directory named DIR. You can use any globbing
|
||||
|
|
@ -655,7 +655,7 @@ This pattern is applied only to directories and not to files.
|
|||
Selects the exact specified file path. You can use any
|
||||
globbing character like * and ? but they never matches a
|
||||
directory slash.
|
||||
This pattern is applied only to files and not to directories.
|
||||
This pattern is applied to both files and directories.
|
||||
.TP
|
||||
.B /PATH/DIR/
|
||||
Selects the exact specified directory path. You can use any
|
||||
|
|
|
|||
|
|
@ -465,7 +465,7 @@ Pattern
|
|||
=FILE
|
||||
Selects any file named as FILE. You can use any globbing
|
||||
character like * and ?.
|
||||
This pattern is applied only to files and not to directories.
|
||||
This pattern is applied to both files and directories.
|
||||
|
||||
=DIR/
|
||||
Selects any directory named DIR. You can use any globbing
|
||||
|
|
@ -476,7 +476,7 @@ Pattern
|
|||
Selects the exact specified file path. You can use any
|
||||
globbing character like * and ? but they never matches a
|
||||
directory slash.
|
||||
This pattern is applied only to files and not to directories.
|
||||
This pattern is applied to both files and directories.
|
||||
|
||||
=/PATH/DIR/
|
||||
Selects the exact specified directory path. You can use any
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue