From aca551a4fe7677ddf0b475d77e6d70934f6e2896 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 7 Mar 2025 15:38:20 +0100 Subject: [PATCH 1/2] Add `cmirror --version` --- cmirror.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmirror.c b/cmirror.c index b1711ec..7340dee 100644 --- a/cmirror.c +++ b/cmirror.c @@ -26,6 +26,8 @@ #include #include +#define CMIRROR_VERSION "v1.7" + // http://owww.molgen.mpg.de/~buczek/glib-doc/ #include @@ -570,6 +572,7 @@ static void usage(char *argv0) { fprintf(stderr, "usage: %s [options] path [node:]path\n" " %s --slave [--local-slave] [--socket-name path] [options] path\n" + " %s --version\n" "\n" " options:\n" " --noop dont change anything\n" @@ -594,7 +597,7 @@ static void usage(char *argv0) { " --socket-name PATH EXPERIMENTAL use PATH as name for AF unix sockets\n" " --noatime don't touch atime on sender\n" " --ignore-permissions do not attempt to change file permissions\n", - argv0, argv0); + argv0, argv0, argv0); _exit(1); } @@ -624,6 +627,7 @@ static struct option options[] = { { "socket-name", 1, NULL, 104 }, { "noatime", 0, &noatime, 1 }, { "ignore-permissions", 0, &ignore_permissions, 1 }, + { "version", 0, NULL, 105 }, { NULL } }; @@ -1478,7 +1482,10 @@ int main(int argc, char **argv) { g_strv_builder_add(ssh_opts_builder, optarg); else if (opt == 104) unix_socket_name = g_strdup(optarg); - else if (opt == '?') + else if (opt == 105) { + printf("cmirror version " CMIRROR_VERSION "\n"); + exit(0); + } else if (opt == '?') usage(argv0); else die("internal error: getopt returned %d\n", opt); From e349d796c4da462134c6fd9393dfc6ec64569c7a Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 7 Mar 2025 15:43:46 +0100 Subject: [PATCH 2/2] Remove "FILE is a socket(ignored)" message --- cmirror.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmirror.c b/cmirror.c index 7340dee..126a281 100644 --- a/cmirror.c +++ b/cmirror.c @@ -869,7 +869,7 @@ static void slave(char *slave_path) { fileop_chmod(fi_want->perm, filename); } } else if (fi_want->type== 'S') { - warn("%s: is a socket(ignored)\n", filename); + ; // silently ignore sockets } else if (fi_want->type == 'C' || fi_want->type == 'B') { if (!fi_is || fi_is->type != fi_want->type || fi_is->rdev != fi_want->rdev) { if (fi_is)