- close stdout and stderr and reopen then as /dev/null when running as
a daemon. This prevents library functions (such as getopt) stuffing up
our protocol stream when errors are detected.
- defer the error message from the options parsing until after the
socket is multiplexed. This allows clients sending new options which
the remote server doesn't understand to get a sensible error message.
diff --git a/options.c b/options.c
index bd0e523..3244f3f 100644
--- a/options.c
+++ b/options.c
@@ -197,7 +197,8 @@
{"port", 1, 0, OPT_PORT},
{0,0,0,0}};
-void parse_arguments(int argc, char *argv[])
+
+int parse_arguments(int argc, char *argv[])
{
int opt;
int option_index;
@@ -301,7 +302,7 @@
preserve_hard_links=1;
#else
rprintf(FERROR,"ERROR: hard links not supported on this platform\n");
- exit_cleanup(1);
+ return 0;
#endif
break;
@@ -412,10 +413,10 @@
break;
default:
- /* rprintf(FERROR,"bad option -%c\n",opt); */
- exit_cleanup(1);
+ return 0;
}
}
+ return 1;
}