mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-04-04 22:44:24 -04:00
Tightened up code in skip_filesystem()
This commit is contained in:
11
flist.c
11
flist.c
@@ -293,6 +293,7 @@ static void set_filesystem(char *fname)
|
||||
STRUCT_STAT st;
|
||||
if (link_stat(fname, &st) != 0)
|
||||
return;
|
||||
|
||||
filesystem_dev = st.st_dev;
|
||||
}
|
||||
|
||||
@@ -695,28 +696,24 @@ void receive_file_entry(struct file_struct **fptr, unsigned short flags, int f)
|
||||
}
|
||||
|
||||
|
||||
/* determine if a file in a different filesstem should be skipped
|
||||
/* determine if a file in a different filesystem should be skipped
|
||||
when one_file_system is set. We bascally only want to include
|
||||
the mount points - but they can be hard to find! */
|
||||
static int skip_filesystem(char *fname, STRUCT_STAT * st)
|
||||
{
|
||||
STRUCT_STAT st2;
|
||||
char *p = strrchr(fname, '/');
|
||||
|
||||
/* skip all but directories */
|
||||
if (!S_ISDIR(st->st_mode))
|
||||
return 1;
|
||||
|
||||
/* if its not a subdirectory then allow */
|
||||
if (!p)
|
||||
if (!strrchr(fname, '/'))
|
||||
return 0;
|
||||
|
||||
*p = 0;
|
||||
if (link_stat(fname, &st2)) {
|
||||
*p = '/';
|
||||
if (link_stat(fname, &st2) != 0) {
|
||||
return 0;
|
||||
}
|
||||
*p = '/';
|
||||
|
||||
return (st2.st_dev != filesystem_dev);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user