mirror of
https://github.com/schoebel/mars
synced 2024-12-24 07:32:46 +00:00
infra: skip any backup subdirectories
This commit is contained in:
parent
fb6ed4aebe
commit
c1df8e7c84
@ -1433,6 +1433,9 @@ struct mars_dir_context {
|
|||||||
#endif
|
#endif
|
||||||
// end_remove_this
|
// end_remove_this
|
||||||
|
|
||||||
|
/* Skip any names / directories used for backup purposes */
|
||||||
|
#define MARS_BACKUP_STR "backup"
|
||||||
|
|
||||||
/* Caution: this is called as a callback from iterate_dir() and friends.
|
/* Caution: this is called as a callback from iterate_dir() and friends.
|
||||||
* Don't deadlock by producing any filesystem output within this!
|
* Don't deadlock by producing any filesystem output within this!
|
||||||
*/
|
*/
|
||||||
@ -1469,6 +1472,8 @@ int mars_filler(void *__buf, const char *name, int namlen, loff_t offset,
|
|||||||
if (!name || !*name || name[0] == '.') {
|
if (!name || !*name || name[0] == '.') {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (strnstr(name, MARS_BACKUP_STR, namlen))
|
||||||
|
return 0;
|
||||||
|
|
||||||
class = cookie->checker(cookie->check_parent,
|
class = cookie->checker(cookie->check_parent,
|
||||||
name, namlen,
|
name, namlen,
|
||||||
@ -1694,6 +1699,9 @@ static int _mars_readdir(struct mars_cookie *cookie)
|
|||||||
mm_segment_t oldfs;
|
mm_segment_t oldfs;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
|
if (unlikely(strstr(cookie->path, MARS_BACKUP_STR)))
|
||||||
|
goto done;
|
||||||
|
|
||||||
oldfs = get_fs();
|
oldfs = get_fs();
|
||||||
set_fs(get_ds());
|
set_fs(get_ds());
|
||||||
f = filp_open(cookie->path, O_DIRECTORY | O_RDONLY, 0);
|
f = filp_open(cookie->path, O_DIRECTORY | O_RDONLY, 0);
|
||||||
@ -1734,6 +1742,7 @@ static int _mars_readdir(struct mars_cookie *cookie)
|
|||||||
|
|
||||||
_mars_order_all(cookie);
|
_mars_order_all(cookie);
|
||||||
|
|
||||||
|
done:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user