From: Andreas Schneider Date: Tue, 25 May 2021 07:36:48 +0000 (+0200) Subject: s3:printing: Migrate samba-bgqd to new cmdline option parser X-Git-Tag: tevent-0.11.0~714 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c90b3db95a9ae43327d8e2f09d39b27505c38f7c;p=thirdparty%2Fsamba.git s3:printing: Migrate samba-bgqd to new cmdline option parser Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- diff --git a/source3/printing/samba-bgqd.c b/source3/printing/samba-bgqd.c index ced1de876c7..4b96fc43092 100644 --- a/source3/printing/samba-bgqd.c +++ b/source3/printing/samba-bgqd.c @@ -21,7 +21,7 @@ #include "source3/locking/share_mode_lock.h" #include "source3/param/loadparm.h" #include "source3/param/param_proto.h" -#include "source3/include/popt_common.h" +#include "lib/cmdline/cmdline.h" #include "lib/util/talloc_stack.h" #include "lib/util/debug.h" #include "lib/util/signal.h" @@ -236,13 +236,6 @@ int main(int argc, const char *argv[]) .arg = &no_process_group, .descrip = "Don't create a new process group" , }, - { - .longName = "log-stdout", - .shortName = 'S', - .argInfo = POPT_ARG_NONE, - .arg = &log_stdout, - .descrip = "Log to stdout" , - }, /* * File descriptor to write the PID of the helper @@ -268,13 +261,27 @@ int main(int argc, const char *argv[]) POPT_TABLEEND }; - talloc_enable_null_tracking(); frame = talloc_stackframe(); umask(0); - setup_logging(progname, DEBUG_DEFAULT_STDERR); - pc = poptGetContext(progname, argc, argv, long_options, 0); + ok = samba_cmdline_init(frame, + SAMBA_CMDLINE_CONFIG_SERVER, + true /* require_smbconf */); + if (!ok) { + DBG_ERR("Failed to setup cmdline parser!\n"); + exit(ENOMEM); + } + + pc = samba_popt_get_context(progname, + argc, + argv, + long_options, + 0); + if (pc == NULL) { + DBG_ERR("Failed to get popt context!\n"); + exit(ENOMEM); + } ret = poptGetNextOpt(pc); if (ret < -1) { @@ -284,6 +291,8 @@ int main(int argc, const char *argv[]) poptFreeContext(pc); + log_stdout = (debug_get_log_type() == DEBUG_STDOUT); + { int keep[] = { 0, 1, 2, ready_signal_fd, watch_fd }; ret = closeall_except(keep, ARRAY_SIZE(keep)); @@ -307,12 +316,9 @@ int main(int argc, const char *argv[]) setup_logging(progname, DEBUG_FILE); } - lp_load_initial_only(get_dyn_CONFIGFILE()); - BlockSignals(true, SIGPIPE); smb_init_locale(); - fault_setup(); dump_core_setup(progname, lp_logfile(frame, lp_sub)); msg_ctx = global_messaging_context(); diff --git a/source3/wscript_build b/source3/wscript_build index 66a816a9ef1..5065f0212b2 100644 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -843,7 +843,7 @@ bld.SAMBA_BINARY('samba-bgqd', source='printing/samba-bgqd.c', deps=''' samba3core - popt_samba3 + CMDLINE_S3 AUTH_COMMON smbd_base ''',