Add basic support for symbolic links.

A test to ensure that it is working is still needed.
This commit is contained in:
Andreas Schneider 2008-05-26 15:58:40 +02:00
parent c16abe8a7b
commit 66fd0e2de0
4 changed files with 14 additions and 4 deletions

View file

@ -65,6 +65,11 @@ int csync_config_load(CSYNC *ctx, const char *config) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Config: max_time_difference = %d",
ctx->options.max_time_difference);
ctx->options.sync_symbolic_links = iniparser_getboolean(dict,
"global:sync_symbolic_links", 0);
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Config: sync_symbolic_links = %d",
ctx->options.sync_symbolic_links);
iniparser_freedict(dict);
return 0;

View file

@ -104,6 +104,7 @@ struct csync_s {
struct {
int max_depth;
int max_time_difference;
int sync_symbolic_links;
char *config_dir;
} options;

View file

@ -388,8 +388,6 @@ static int _csync_sync_dir(CSYNC *ctx, csync_file_stat_t *st) {
ctx->replica = dest;
/* TODO: check return values */
times[0].tv_sec = times[1].tv_sec = st->modtime;
times[0].tv_usec = times[1].tv_usec = 0;

View file

@ -164,12 +164,18 @@ int csync_walker(CSYNC *ctx, const char *file, const csync_vio_file_stat_t *fs,
case CSYNC_FTW_FLAG_SLINK:
switch (fs->mode & S_IFMT) {
case S_IFREG:
case S_IFLNK:
/* TODO: handle symbolic links on unix systems */
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s", file);
return csync_detect_update(ctx, file, fs, CSYNC_FTW_TYPE_FILE);
break;
case S_IFLNK:
/* TODO: check if plugin supports symlinks */
if (ctx->options.sync_symbolic_links) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "symlink: %s", file);
return csync_detect_update(ctx, file, fs, CSYNC_FTW_TYPE_FILE);
}
break;
default:
break;
}