Skip to content

Commit

Permalink
Merge pull request #17 from mariux64/add-ignore-permissions
Browse files Browse the repository at this point in the history
Add option --ignore-permissions
  • Loading branch information
donald authored Jun 3, 2023
2 parents 055fdc2 + 0e9d5c5 commit 3ba77c4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmirror.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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 }
};

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3ba77c4

Please sign in to comment.