From d9f67eebf621adacf5514c7ba1ed17b4953db762 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 29 Oct 2010 15:29:09 +1100 Subject: [PATCH] s3-debug Remove last direct assignements to DEBUGLEVEL All future assignments of the debug level should go via lp_set_cmdline("log level", "x") because this will ensure the value is not overwritten in an smb.conf load. Andrew Bartlett --- source3/libsmb/libsmb_setget.c | 4 +++- source3/rpcclient/rpcclient.c | 2 +- source3/torture/masktest.c | 2 +- source3/torture/torture.c | 2 +- source3/torture/vfstest.c | 2 +- source3/utils/smbpasswd.c | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source3/libsmb/libsmb_setget.c b/source3/libsmb/libsmb_setget.c index 20835781ec0..f2f5aec6c46 100644 --- a/source3/libsmb/libsmb_setget.c +++ b/source3/libsmb/libsmb_setget.c @@ -90,8 +90,10 @@ smbc_getDebug(SMBCCTX *c) void smbc_setDebug(SMBCCTX *c, int debug) { + char buf[32]; + snprintf(buf, sizeof(buf), "%d", debug); c->debug = debug; - DEBUGLEVEL = debug; + lp_set_cmdline("log level", buf); } /** diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index a98f500e626..707889a44fc 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -324,7 +324,7 @@ static NTSTATUS cmd_debuglevel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, } if (argc == 2) { - DEBUGLEVEL = atoi(argv[1]); + lp_set_cmdline("log level", argv[1]); } printf("debuglevel is %d\n", DEBUGLEVEL); diff --git a/source3/torture/masktest.c b/source3/torture/masktest.c index 335bc4ca223..1fc46b9c280 100644 --- a/source3/torture/masktest.c +++ b/source3/torture/masktest.c @@ -515,7 +515,7 @@ static void usage(void) NumLoops = atoi(optarg); break; case 'd': - DEBUGLEVEL = atoi(optarg); + lp_set_cmdline("log level", optarg); break; case 'E': die_on_error = 1; diff --git a/source3/torture/torture.c b/source3/torture/torture.c index bc4b58be739..161c6f9a648 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -8009,7 +8009,7 @@ static void usage(void) torture_numops = atoi(optarg); break; case 'd': - DEBUGLEVEL = atoi(optarg); + lp_set_cmdline("log level", optarg); break; case 'O': sockops = optarg; diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c index 3b0ec54564c..3ebe63ee536 100644 --- a/source3/torture/vfstest.c +++ b/source3/torture/vfstest.c @@ -188,7 +188,7 @@ static NTSTATUS cmd_debuglevel(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int a } if (argc == 2) { - DEBUGLEVEL = atoi(argv[1]); + lp_set_cmdline("log level", argv[1]); } printf("debuglevel is %d\n", DEBUGLEVEL); diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index c530c78f41f..b4e8b19f1f8 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -152,7 +152,7 @@ static int process_options(int argc, char **argv, int local_flags) lp_set_name_resolve_order(optarg); break; case 'D': - DEBUGLEVEL = atoi(optarg); + lp_set_cmdline("log level", optarg); break; case 'U': { got_username = True; -- 2.34.1