diff --git a/options.c b/options.c index 6ba13b7..9ecbd87 100644 --- a/options.c +++ b/options.c @@ -1320,40 +1320,18 @@ int parse_arguments(int *argc_p, const char ***argv_p) if (pc) poptFreeContext(pc); pc = poptGetContext(RSYNC_NAME, argc, argv, long_options, 0); - if (!am_server) - poptReadDefaultConfig(pc, 0); + /* Check for --server and --daemon + * before processing popt aliases */ while ((opt = poptGetNextOpt(pc)) != -1) { - /* most options are handled automatically by popt; - * only special cases are returned and listed here. */ - switch (opt) { - case OPT_VERSION: - print_rsync_version(FINFO); - exit_cleanup(0); - case OPT_SERVER: - if (!am_server) { - /* Disable popt aliases on the server side and - * then start parsing the options again. */ - poptFreeContext(pc); - pc = poptGetContext(RSYNC_NAME, argc, argv, - long_options, 0); - am_server = 1; - } + am_server = 1; #ifdef ICONV_OPTION iconv_opt = NULL; #endif break; - case OPT_SENDER: - if (!am_server) { - usage(FERROR); - exit_cleanup(RERR_SYNTAX); - } - am_sender = 1; - break; - case OPT_DAEMON: if (am_daemon) { strlcpy(err_buf, @@ -1423,6 +1401,31 @@ int parse_arguments(int *argc_p, const char ***argv_p) daemon_opt = 0; am_daemon = 1; return 1; + } + } + + /* Process popt aliases */ + if (!am_server) + poptFreeContext(pc); + pc = poptGetContext(RSYNC_NAME, argc, argv, long_options, 0); + poptReadDefaultConfig(pc, 0); + + while ((opt = poptGetNextOpt(pc)) != -1) { + /* most options are handled automatically by popt; + * only special cases are returned and listed here. */ + + switch (opt) { + case OPT_VERSION: + print_rsync_version(FINFO); + exit_cleanup(0); + + case OPT_SENDER: + if (!am_server) { + usage(FERROR); + exit_cleanup(RERR_SYNTAX); + } + am_sender = 1; + break; case OPT_MODIFY_WINDOW: /* The value has already been set by popt, but