Toggle navigation
Toggle navigation
This project
Loading...
Sign in
UT
/
clsync
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
redmine
2015-03-29 15:12:16 +0300
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
f00df0f992cfc47430c3c55f4942b998142eed6e
f00df0f9
2 parents
7a54144e
89382d90
Merge branch 'master' of
https://github.com/xaionaro/clsync
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
17 deletions
configuration.h
main.c
privileged.c
sync.c
configuration.h
View file @
f00df0f
...
...
@@ -37,16 +37,46 @@
#define MAXPERMITTEDHOOKFILES (1<<8)
#ifdef __CLSYNC_COMMON_H
# define DEFAULT_NOTIFYENGINE NE_UNDEFINED
# ifdef __linux__
# undef DEFAULT_NOTIFYENGINE
# define DEFAULT_NOTIFYENGINE NE_INOTIFY
# ifndef DEFAULT_NOTIFYENGINE
# ifdef __linux__
# ifdef INOTIFY_SUPPORT
# define DEFAULT_NOTIFYENGINE NE_INOTIFY
# endif
# endif
# endif
# ifdef __FreeBSD__
# undef DEFAULT_NOTIFYENGINE
# define DEFAULT_NOTIFYENGINE NE_KQUEUE
# ifndef DEFAULT_NOTIFYENGINE
# ifdef __FreeBSD__
# ifdef KQUEUE_SUPPORT
# define DEFAULT_NOTIFYENGINE NE_KQUEUE
# endif
# endif
# endif
# ifndef DEFAULT_NOTIFYENGINE
# ifdef INOTIFY_SUPPORT
# define DEFAULT_NOTIFYENGINE NE_INOTIFY
# endif
# endif
# ifndef DEFAULT_NOTIFYENGINE
# ifdef GIO_SUPPORT
# define DEFAULT_NOTIFYENGINE NE_GIO
# endif
# endif
# ifndef DEFAULT_NOTIFYENGINE
# ifdef KQUEUE_SUPPORT
# define DEFAULT_NOTIFYENGINE NE_KQUEUE
# endif
# endif
# ifndef DEFAULT_NOTIFYENGINE
# ifdef BSM_SUPPORT
# define DEFAULT_NOTIFYENGINE NE_BSM
# endif
# endif
# ifndef DEFAULT_NOTIFYENGINE
# warning No default monitor subsystem is set
# define DEFAULT_NOTIFYENGINE NE_UNDEFINED
# endif
#endif
#define DEFAULT_RULES_PERM RA_ALL
#define DEFAULT_COLLECTDELAY 30
#define DEFAULT_SYNCDELAY (DEFAULT_COLLECTDELAY)
...
...
main.c
View file @
f00df0f
...
...
@@ -813,6 +813,7 @@ static inline long xstrtol(const char *str, int *err) {
long
res
;
char
*
endptr
;
errno
=
0
;
res
=
strtol
(
str
,
&
endptr
,
0
);
if
(
errno
||
*
endptr
)
{
error
(
"argument
\"
%s
\"
can't be parsed as a number"
,
str
);
...
...
@@ -2050,6 +2051,14 @@ int ctx_check(ctx_t *ctx_p) {
ret
=
errno
=
EINVAL
;
error
(
"Option
\"
--synclist-simplify
\"
with nodes
\"
rsyncdirect
\"
and
\"
rsyncshell
\"
are incompatible."
);
}
#ifdef GIO_SUPPORT
# ifdef SECCOMP_SUPPORT
if
((
ctx_p
->
flags
[
MONITOR
]
==
NE_GIO
)
&&
(
ctx_p
->
flags
[
SECCOMP_FILTER
]))
{
ret
=
errno
=
EINVAL
;
error
(
"GIO is not compatible with seccomp filter (
\"
--monitor=gio
\"
and
\"
--seccomp-filter
\"
are incompatible)"
);
}
# endif
#endif
#ifdef FANOTIFY_SUPPORT
if
(
ctx_p
->
flags
[
MONITOR
]
==
NE_FANOTIFY
)
...
...
@@ -2417,17 +2426,16 @@ int main(int _argc, char *_argv[]) {
}
debug
(
5
,
"rwatchdir ==
\"
%s
\"
"
,
rwatchdir
);
/*
stat64_t
stat64
=
{
0
};
if
(
lstat64
(
ctx_p
->
watchdir
,
&
stat64
))
{
error
(
"Cannot lstat64() on
\"
%s
\"
"
,
ctx_p
->
watchdir
);
if
(
!
ret
)
ret
=
errno
;
}
else
{
if (ctx_p->flags[EXCLUDEMOUNTPOINTS])
ctx_p->st_dev = stat64.st_dev;
ctx_p
->
st_dev
=
stat64
.
st_dev
;
/*
if ((stat64.st_mode & S_IFMT) == S_IFLNK) {
// The proplems may be due to FTS_PHYSICAL option of ft
p
_open() in sync_initialsync_rsync_walk(),
// The proplems may be due to FTS_PHYSICAL option of ft
s
_open() in sync_initialsync_rsync_walk(),
// so if the "watch dir" is just a symlink it doesn't walk recursivly. For example, in "-R" case
// it disables filters, because exclude-list will be empty.
#ifdef VERYPARANOID
...
...
@@ -2446,11 +2454,11 @@ int main(int _argc, char *_argv[]) {
ret = EINVAL;
} else {
char *watchdir_resolved;
#
ifdef VERY
PARANOID
#
ifdef
PARANOID
if (ctx_p->watchdirsize)
if (ctx_p->watchdir != NULL)
free(ctx_p->watchdir);
#endif
#
endif
size_t watchdir_resolved_part_len = strlen(watchdir_resolved_part);
ctx_p->watchdirsize = watchdir_resolved_part_len+1; // Not true for case of relative symlink
...
...
@@ -2479,8 +2487,8 @@ int main(int _argc, char *_argv[]) {
free(watchdir_resolved_part);
#endif // VERYPARANOID else
}
}
*/
}
if
(
!
ret
)
{
parse_parameter
(
ctx_p
,
WATCHDIR
,
rwatchdir
,
PS_CORRECTION
);
...
...
privileged.c
View file @
f00df0f
...
...
@@ -106,6 +106,7 @@
SECCOMP_ALLOW_ACCUM_SYSCALL(rt_sigprocmask), \
SECCOMP_ALLOW_ACCUM_SYSCALL(rt_sigaction), \
SECCOMP_ALLOW_ACCUM_SYSCALL(nanosleep), \
SECCOMP_ALLOW_ACCUM_SYSCALL(shmdt), \
/* Syscalls allowed to non-privileged thread */
...
...
@@ -1881,9 +1882,11 @@ int privileged_deinit(ctx_t *ctx_p)
}
case
SM_PROCESS
:
{
int
status
;
__privileged_kill_child_itself
(
helper_pid
,
SIGKILL
);
debug
(
9
,
"waitpid(%u, ...)"
,
helper_pid
);
waitpid
(
helper_pid
,
&
status
,
0
);
if
(
!
ctx_p
->
flags
[
SECCOMP_FILTER
])
{
__privileged_kill_child_itself
(
helper_pid
,
SIGKILL
);
debug
(
9
,
"waitpid(%u, ...)"
,
helper_pid
);
waitpid
(
helper_pid
,
&
status
,
0
);
}
shm_free
((
void
*
)
cmd_p
);
shm_free
((
void
*
)
cmd_ret_p
);
# ifdef HL_LOCKS
...
...
sync.c
View file @
f00df0f
...
...
@@ -1351,12 +1351,15 @@ int sync_initialsync_walk(ctx_t *ctx_p, const char *dirpath, indexes_t *indexes_
if
(
ctx_p
->
flags
[
EXCLUDEMOUNTPOINTS
]
&&
node
->
fts_info
==
FTS_D
)
{
if
(
rsync_and_prefer_excludes
)
{
if
(
node
->
fts_statp
->
st_dev
!=
ctx_p
->
st_dev
)
{
debug
(
3
,
"Excluding
\"
%s
\"
due to location on other device: node->fts_statp->st_dev [0x%o] != ctx_p->st_dev [0x%o]"
,
path_rel
,
node
->
fts_statp
->
st_dev
,
ctx_p
->
st_dev
);
if
(
queue_id
==
QUEUE_AUTO
)
{
int
i
=
0
;
while
(
i
<
QUEUE_MAX
)
indexes_addexclude
(
indexes_p
,
strdup
(
path_rel
),
EVIF_CONTENTRECURSIVELY
,
i
++
);
}
else
indexes_addexclude
(
indexes_p
,
strdup
(
path_rel
),
EVIF_CONTENTRECURSIVELY
,
queue_id
);
fts_set
(
tree
,
node
,
FTS_SKIP
);
}
}
else
if
(
!
ctx_p
->
flags
[
RSYNCPREFERINCLUDE
])
...
...
Please
register
or
login
to post a comment