summaryrefslogtreecommitdiff
path: root/options.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2006-05-30 17:14:17 +0000
committerWayne Davison <wayned@samba.org>2006-05-30 17:14:17 +0000
commit232658d9d383c6895dae982e99cf35ddd8f1d6cd (patch)
treee059d5a8c8a665181f27387e48574f08f0ef0d40 /options.c
parentc000002f460f68baed89e9f3720f92227f576575 (diff)
downloadrsync-232658d9d383c6895dae982e99cf35ddd8f1d6cd.tar.gz
- Allow the --log-file-format option to override the "log format"
setting when starting a daemon. - Make a daemon refuse all --log-file* options. - Don't use refuse logic on daemon-mode options given to a daemon module -- reject them via their own message.
Diffstat (limited to 'options.c')
-rw-r--r--options.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/options.c b/options.c
index 5df166cc..60a72fd3 100644
--- a/options.c
+++ b/options.c
@@ -554,6 +554,7 @@ static void daemon_usage(enum logcode F)
rprintf(F," --no-detach do not detach from the parent\n");
rprintf(F," --port=PORT listen on alternate port number\n");
rprintf(F," --log-file=FILE override the \"log file\" setting\n");
+ rprintf(F," --log-file-format=FMT override the \"log format\" setting\n");
rprintf(F," --sockopts=OPTIONS specify custom TCP options\n");
rprintf(F," -v, --verbose increase verbosity\n");
#ifdef INET6
@@ -578,6 +579,7 @@ static struct poptOption long_daemon_options[] = {
#endif
{"detach", 0, POPT_ARG_VAL, &no_detach, 0, 0, 0 },
{"log-file", 0, POPT_ARG_STRING, &logfile_name, 0, 0, 0 },
+ {"log-file-format", 0, POPT_ARG_STRING, &logfile_format, 0, 0, 0 },
{"no-detach", 0, POPT_ARG_VAL, &no_detach, 1, 0, 0 },
{"port", 0, POPT_ARG_INT, &rsync_port, 0, 0, 0 },
{"sockopts", 0, POPT_ARG_STRING, &sockopts, 0, 0, 0 },
@@ -678,17 +680,6 @@ static void set_refuse_options(char *bp)
*cp = ' ';
bp = cp + 1;
}
-
- for (op = long_options; ; op++) {
- *shortname = op->shortName;
- if (!op->longName && !*shortname)
- break;
- if (op->val == OPT_DAEMON) {
- if (op->argInfo == POPT_ARG_VAL)
- op->argInfo = POPT_ARG_NONE;
- op->val = (op - long_options) + OPT_REFUSED_BASE;
- }
- }
}
@@ -793,6 +784,8 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
if (ref && *ref)
set_refuse_options(ref);
+ if (am_daemon)
+ set_refuse_options("log-file*");
/* TODO: Call poptReadDefaultConfig; handle errors. */
@@ -1317,11 +1310,9 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
if (stdout_format_has_i || log_format_has(stdout_format, 'o'))
stdout_format_has_o_or_i = 1;
- if (am_daemon)
- logfile_name = NULL;
- else if (logfile_name) {
+ if (logfile_name && !am_daemon) {
if (!logfile_format) {
- logfile_format = "%i %n%L (!)";
+ logfile_format = "%i %n%L";
logfile_format_has_i = logfile_format_has_o_or_i = 1;
} else {
if (log_format_has(logfile_format, 'i'))