The common cmdline parser provides --debug-stdout.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
<command>nmbd</command>
<arg choice="opt">-D|--daemon</arg>
<arg choice="opt">-F|--foreground</arg>
- <arg choice="opt">-S|--log-stdout</arg>
<arg choice="opt">-i|--interactive</arg>
<arg choice="opt">-V</arg>
<arg choice="opt">-d <debug level></arg>
</para></listitem>
</varlistentry>
- <varlistentry>
- <term>-S|--log-stdout</term>
- <listitem><para>If specified, this parameter causes
- <command>nmbd</command> to log to standard output rather
- than a file.</para></listitem>
- </varlistentry>
-
<varlistentry>
<term>-i|--interactive</term>
<listitem><para>If this parameter is specified it causes the
<command>smbd</command>
<arg choice="opt">-D|--daemon</arg>
<arg choice="opt">-F|--foreground</arg>
- <arg choice="opt">-S|--log-stdout</arg>
<arg choice="opt">-i|--interactive</arg>
<arg choice="opt">-V</arg>
<arg choice="opt">-b|--build-options</arg>
</para></listitem>
</varlistentry>
- <varlistentry>
- <term>-S|--log-stdout</term>
- <listitem><para>If specified, this parameter causes
- <command>smbd</command> to log to standard output rather
- than a file.</para></listitem>
- </varlistentry>
-
<varlistentry>
<term>-i|--interactive</term>
<listitem><para>If this parameter is specified it causes the
<command>winbindd</command>
<arg choice="opt">-D|--daemon</arg>
<arg choice="opt">-F|--foreground</arg>
- <arg choice="opt">-S|--stdout</arg>
<arg choice="opt">-i|--interactive</arg>
<arg choice="opt">-d <debug level></arg>
<arg choice="opt">-s <smb config file></arg>
</para></listitem>
</varlistentry>
- <varlistentry>
- <term>-S|--stdout</term>
- <listitem><para>If specified, this parameter causes
- <command>winbindd</command> to log to standard output rather
- than a file.</para></listitem>
- </varlistentry>
-
&stdarg.server.debug;
&popt.common.samba;
&popt.autohelp;
"--option=server role check:inhibit=yes",
"--foreground",
config_file,
- debug_get_output_is_stdout()?"--log-stdout":NULL,
+ debug_get_output_is_stdout()?"--debug-stdout":NULL,
NULL);
/* the parent should not be able to call through nss_winbind */
if (!winbind_off()) {
"-l", $env_vars->{LOGDIR});
if (not defined($dont_log_stdout)) {
- push(@args, "--log-stdout");
+ push(@args, "--debug-stdout");
}
return (@preargs, $binary, @args, @optargs);
}
$binary = Samba::bindir_path($self, "winbindd");
@full_cmd = $self->make_bin_cmd($binary, $env_vars,
- $ENV{WINBINDD_OPTIONS}, $ENV{WINBINDD_VALGRIND}, "N/A");
-
- if (not defined($ENV{WINBINDD_DONT_LOG_STDOUT})) {
- push(@full_cmd, "--stdout");
- }
+ $ENV{WINBINDD_OPTIONS},
+ $ENV{WINBINDD_VALGRIND},
+ $ENV{WINBINDD_DONT_LOG_STDOUT});
# fork and exec() winbindd in the child process
$daemon_ctx = {
OPT_DAEMON = 1000,
OPT_INTERACTIVE,
OPT_FORK,
- OPT_NO_PROCESS_GROUP,
- OPT_LOG_STDOUT
+ OPT_NO_PROCESS_GROUP
};
struct poptOption long_options[] = {
POPT_AUTOHELP
.val = OPT_NO_PROCESS_GROUP,
.descrip = "Don't create a new process group",
},
- {
- .longName = "log-stdout",
- .shortName = 'S',
- .argInfo = POPT_ARG_NONE,
- .arg = NULL,
- .val = OPT_LOG_STDOUT,
- .descrip = "Log to stdout",
- },
{
.longName = "hosts",
.shortName = 'H',
case OPT_NO_PROCESS_GROUP:
no_process_group = true;
break;
- case OPT_LOG_STDOUT:
- log_stdout = true;
- break;
default:
d_fprintf(stderr, "\nInvalid option %s: %s\n\n",
poptBadOption(pc, 0), poptStrerror(opt));
/* Ignore children - no zombies. */
CatchChild();
+ log_stdout = (debug_get_log_type() == DEBUG_STDOUT);
if ( opt_interactive ) {
Fork = False;
log_stdout = True;
exit(1);
}
- if (log_stdout) {
- setup_logging(argv[0], DEBUG_STDOUT);
- } else {
+ if (!log_stdout) {
setup_logging( argv[0], DEBUG_FILE);
}
OPT_INTERACTIVE,
OPT_FORK,
OPT_NO_PROCESS_GROUP,
- OPT_LOG_STDOUT
};
struct poptOption long_options[] = {
POPT_AUTOHELP
.val = OPT_NO_PROCESS_GROUP,
.descrip = "Don't create a new process group" ,
},
- {
- .longName = "log-stdout",
- .shortName = 'S',
- .argInfo = POPT_ARG_NONE,
- .arg = NULL,
- .val = OPT_LOG_STDOUT,
- .descrip = "Log to stdout" ,
- },
{
.longName = "build-options",
.shortName = 'b',
case OPT_NO_PROCESS_GROUP:
no_process_group = true;
break;
- case OPT_LOG_STDOUT:
- log_stdout = true;
- break;
case 'b':
print_build_options = True;
break;
}
poptFreeContext(pc);
+ log_stdout = (debug_get_log_type() == DEBUG_STDOUT);
+
if (interactive) {
Fork = False;
log_stdout = True;
}
- if (log_stdout) {
- setup_logging(argv[0], DEBUG_STDOUT);
- } else {
+ if (!log_stdout) {
setup_logging(argv[0], DEBUG_FILE);
}
enum {
OPT_DAEMON = 1000,
OPT_FORK,
- OPT_NO_PROCESS_GROUP,
- OPT_LOG_STDOUT
+ OPT_NO_PROCESS_GROUP
};
struct poptOption long_options[] = {
POPT_AUTOHELP
- {
- .longName = "stdout",
- .shortName = 'S',
- .argInfo = POPT_ARG_NONE,
- .arg = NULL,
- .val = OPT_LOG_STDOUT,
- .descrip = "Log to stdout",
- },
{
.longName = "foreground",
.shortName = 'F',
break;
case 'i':
interactive = True;
- log_stdout = True;
- Fork = False;
break;
case OPT_FORK:
Fork = false;
case OPT_NO_PROCESS_GROUP:
no_process_group = true;
break;
- case OPT_LOG_STDOUT:
- log_stdout = true;
- break;
case 'n':
opt_nocache = true;
break;
exit(1);
}
+ log_stdout = (debug_get_log_type() == DEBUG_STDOUT);
+ if (interactive) {
+ Fork = true;
+ log_stdout = true;
+ }
+
if (log_stdout && Fork) {
d_fprintf(stderr, "\nERROR: "
"Can't log to stdout (-S) unless daemon is in foreground +(-F) or interactive (-i)\n\n");
"--option=server role check:inhibit=yes",
"--foreground",
config_file,
- debug_get_output_is_stdout()?"--stdout":NULL,
+ debug_get_output_is_stdout()?"--debug-stdout":NULL,
NULL);
if (subreq == NULL) {
DEBUG(0, ("Failed to start winbindd as child daemon\n"));