diff --git a/cmirror.c b/cmirror.c index c625d05..bca9caa 100644 --- a/cmirror.c +++ b/cmirror.c @@ -289,6 +289,7 @@ static int opt_nice; static int unix_socket; static char *unix_socket_name; static int noatime; +static int ignore_permissions; /* globals */ @@ -457,7 +458,7 @@ static void check_perm(FileInfo *is, FileInfo *want) { warn("chown %d:%d %s\n", want->uid, want->gid, is->name); fileop_lchown(want->uid, want->gid, is->name); } - if (want->perm != is->perm) { + if (!ignore_permissions && want->perm != is->perm) { if (!quiet) warn("chmod %03o %s\n", want->perm, is->name); fileop_chmod(want->perm, is->name); @@ -591,7 +592,8 @@ static void usage(char *argv0) { " --nice EXPERIMENTAL nice\n" " --unix-socket EXPERIMENTAL establish data channel over ssh via AF unix sockets\n" " --socket-name PATH EXPERIMENTAL use PATH as name for AF unix sockets\n" - " --noatime don't touch atime on sender\n", + " --noatime don't touch atime on sender\n" + " --ignore-permissions do not attempt to change file permissions\n", argv0, argv0); _exit(1); } @@ -621,6 +623,7 @@ static struct option options[] = { { "unix-socket", 0, &unix_socket, 1 }, { "socket-name", 1, NULL, 104 }, { "noatime", 0, &noatime, 1 }, + { "ignore-permissions", 0, &ignore_permissions, 1 }, { NULL } }; @@ -1232,6 +1235,8 @@ static void master(char *master_path, char *target) { } if (slave_unprivileged || strcmp(slave_user, "root")) g_ptr_array_add(args, "--unprivileged"); + if (ignore_permissions) + g_ptr_array_add(args, "--ignore-permissions"); g_ptr_array_add(args, slave_path); g_ptr_array_add(args, NULL);